Skip to content

Show recommended model on failture#7040

Merged
DOsinga merged 2 commits intomainfrom
list-models-on-failure
Feb 6, 2026
Merged

Show recommended model on failture#7040
DOsinga merged 2 commits intomainfrom
list-models-on-failure

Conversation

@DOsinga
Copy link
Collaborator

@DOsinga DOsinga commented Feb 6, 2026

Summary

Fixes: #2545

@DOsinga DOsinga marked this pull request as ready for review February 6, 2026 14:39
@DOsinga DOsinga requested review from Copilot and jamadeo February 6, 2026 14:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses issue #2545 by enhancing model configuration error messages to display available models when a provider returns a "model not supported" error. When a user configures an unsupported model, the enhanced error message will now include a list of recommended models for the provider, reducing friction during initial setup.

Changes:

  • Added an enhance_model_error function that detects model-related errors and appends a list of available models to the error message
  • Modified the error handling in reply_message_stream to call enhance_model_error before returning error streams

};

let msg_lower = msg.to_lowercase();
if !msg_lower.contains("404") || !msg_lower.contains("model") {
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This checks for "404" but the linked issue #2545 describes "400 error" scenarios when models are not supported. Based on the issue description and the fact that unsupported model errors typically return 400 Bad Request (not 404 Not Found), this should check for "400" instead of "404".

Suggested change
if !msg_lower.contains("404") || !msg_lower.contains("model") {
if !msg_lower.contains("400") || !msg_lower.contains("model") {

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to copilot's point, is it always a 404?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no idea, but it's a good point

Comment on lines 23 to 42
async fn enhance_model_error(error: ProviderError, provider: &Arc<dyn Provider>) -> ProviderError {
let ProviderError::RequestFailed(ref msg) = error else {
return error;
};

let msg_lower = msg.to_lowercase();
if !msg_lower.contains("404") || !msg_lower.contains("model") {
return error;
}

let Ok(Some(models)) = provider.fetch_recommended_models().await else {
return error;
};

ProviderError::RequestFailed(format!(
"{}. Available models for this provider: {}",
msg,
models.join(", ")
))
}
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new enhance_model_error function lacks test coverage. Given that other functions in this file have tests, consider adding tests to verify this function correctly identifies model errors (with both "400" and "model" in the message), successfully fetches recommended models, and properly formats the enhanced error message.

Copilot uses AI. Check for mistakes.
};

let msg_lower = msg.to_lowercase();
if !msg_lower.contains("404") || !msg_lower.contains("model") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential future enhancement: if we get good enough at identifying the kinds of errors that mean a model change is needed, should we open the model selection modal for the user in addition to showing a message?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, maybe at some point. we can't really here and as a desktop user you shouldn't get into this - this is mostly for the CLI where specify a model that doesn't exist.

};

let msg_lower = msg.to_lowercase();
if !msg_lower.contains("404") || !msg_lower.contains("model") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to copilot's point, is it always a 404?

@alexhancock
Copy link
Collaborator

LGTM for a merge

@DOsinga DOsinga added this pull request to the merge queue Feb 6, 2026
Merged via the queue into main with commit 3dcb03c Feb 6, 2026
18 checks passed
@DOsinga DOsinga deleted the list-models-on-failure branch February 6, 2026 19:35
zanesq added a commit that referenced this pull request Feb 7, 2026
* 'main' of github.com:block/goose:
  refactor: move disable_session_naming into AgentConfig (#7062)
  Add global config switch to disable automatic session naming (#7052)
  docs: add blog post - 8 Things You Didn't Know About Code Mode (#7059)
  fix: ensure animated elements are visible when prefers-reduced-motion is enabled (#7047)
  Show recommended model on failture (#7040)
  feat(ui): add session content search via API (#7050)
  docs: fix img url (#7053)
  Desktop UI for deleting custom providers (#7042)
  Add blog post: How I Used RPI to Build an OpenClaw Alternative (#7051)
kuccello pushed a commit to kuccello/goose that referenced this pull request Feb 7, 2026
Co-authored-by: Douwe Osinga <douwe@squareup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Print known/supported models when provider configuration fails with "The requested model is not supported." error

4 participants