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>
tlongwell-block added a commit that referenced this pull request Feb 9, 2026
* origin/main: (55 commits)
  test(mcp): add image tool test and consolidate MCP test fixtures (#7019)
  fix: remove Option from model listing return types, propagate errors (#7074)
  fix: lazy provider creation for goose acp (#7026) (#7066)
  Smoke tests: split compaction test and use debug build (#6984)
  fix(deps): trim bat to resolve RUSTSEC-2024-0320 (#7061)
  feat: expose AGENT_SESSION_ID env var to extension child processes (#7072)
  fix: add XML tool call parsing fallback for Qwen3-coder via Ollama (#6882)
  Remove clippy too_many_lines lint and decompose long functions (#7064)
  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)
  Remove build-dependencies section from Cargo.toml (#6946)
  add /rp-why skill blog post (#6997)
  fix: fix snake_case function names in code_execution instructions (#7035)
  ...

# Conflicts:
#	scripts/test_subrecipes.sh
lifeizhou-ap added a commit that referenced this pull request Feb 9, 2026
* main: (101 commits)
  fix: lazy provider creation for goose acp (#7026) (#7066)
  Smoke tests: split compaction test and use debug build (#6984)
  fix(deps): trim bat to resolve RUSTSEC-2024-0320 (#7061)
  feat: expose AGENT_SESSION_ID env var to extension child processes (#7072)
  fix: add XML tool call parsing fallback for Qwen3-coder via Ollama (#6882)
  Remove clippy too_many_lines lint and decompose long functions (#7064)
  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)
  Remove build-dependencies section from Cargo.toml (#6946)
  add /rp-why skill blog post (#6997)
  fix: fix snake_case function names in code_execution instructions (#7035)
  Document max_turns settings for recipes and subagents (#7044)
  feat: update Groq declarative data with Preview Models (#7023)
  ...
jh-block added a commit that referenced this pull request Feb 9, 2026
* origin/main: (54 commits)
  chore: strip posthog for sessions/models/daily only (#7079)
  tidy: clean up old benchmark and add gym (#7081)
  fix: use command.process_group(0) for CLI providers, not just MCP (#7083)
  added build notify (#6891)
  test(mcp): add image tool test and consolidate MCP test fixtures (#7019)
  fix: remove Option from model listing return types, propagate errors (#7074)
  fix: lazy provider creation for goose acp (#7026) (#7066)
  Smoke tests: split compaction test and use debug build (#6984)
  fix(deps): trim bat to resolve RUSTSEC-2024-0320 (#7061)
  feat: expose AGENT_SESSION_ID env var to extension child processes (#7072)
  fix: add XML tool call parsing fallback for Qwen3-coder via Ollama (#6882)
  Remove clippy too_many_lines lint and decompose long functions (#7064)
  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)
  ...
dianed-square added a commit that referenced this pull request Feb 9, 2026
* origin/main: (141 commits)
  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)
  Remove build-dependencies section from Cargo.toml (#6946)
  add /rp-why skill blog post (#6997)
  fix: fix snake_case function names in code_execution instructions (#7035)
  Document max_turns settings for recipes and subagents (#7044)
  feat: update Groq declarative data with Preview Models (#7023)
  fix(codex): propagate extended PATH to codex subprocess (#6874)
  Switch tetrate tool filtering back to supports_computer_use (#7024)
  feat(ui): add inline rename for chat sessions in sidebar (#6995)
  fix: handle toolnames without underscores (#7015)
  feat(claude-code): use stream-json protocol for persistent sessions (#7029)
  test(providers): add model listing to live provider suite (#7038)
  Agent added too much (#7036)
  ...
Tyler-Hardin pushed a commit to Tyler-Hardin/goose that referenced this pull request Feb 11, 2026
Co-authored-by: Douwe Osinga <douwe@squareup.com>
Tyler-Hardin pushed a commit to Tyler-Hardin/goose that referenced this pull request Feb 11, 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