{"record":{"id":"7038aff7ad0f9929","repo":"charmbracelet/crush","slug":"s-model-model-q-found-in-multiple-providers-s-7038af","errorCode":null,"errorMessage":"%s model: model %q found in multiple providers: %s. Please specify provider using 'provider/model' format","messagePattern":"(.+?) model: model %q found in multiple providers: (.+?)\\. Please specify provider using 'provider/model' format","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/run.go","lineNumber":660,"sourceCode":"\t\treturn false\n\t}\n\tif wantProvider != \"\" && wantProvider != providerName {\n\t\treturn false\n\t}\n\treturn strings.EqualFold(modelID, wantID)\n}\n\n// validateModelMatches ensures exactly one match exists.\nfunc validateModelMatches(matches []modelMatch, modelID, label string) (modelMatch, error) {\n\tswitch {\n\tcase len(matches) == 0:\n\t\treturn modelMatch{}, fmt.Errorf(\"%s model %q not found\", label, modelID)\n\tcase len(matches) > 1:\n\t\tnames := make([]string, len(matches))\n\t\tfor i, m := range matches {\n\t\t\tnames[i] = m.provider\n\t\t}\n\t\treturn modelMatch{}, fmt.Errorf(\n\t\t\t\"%s model: model %q found in multiple providers: %s. Please specify provider using 'provider/model' format\",\n\t\t\tlabel, modelID, strings.Join(names, \", \"),\n\t\t)\n\t}\n\treturn matches[0], nil\n}\n\n// resolveSession returns the session to use for a non-interactive run.\n// If continueSessionID is set it fetches that session; if useLast is set it\n// returns the most recently updated top-level session; otherwise it creates a\n// new one.\nfunc resolveSession(ctx context.Context, c *client.Client, wsID, continueSessionID string, useLast bool) (*proto.Session, error) {\n\tswitch {\n\tcase continueSessionID != \"\":\n\t\tsess, err := c.GetSession(ctx, wsID, continueSessionID)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"session not found: %s\", continueSessionID)\n\t\t}","sourceCodeStart":642,"sourceCodeEnd":678,"githubUrl":"https://github.com/charmbracelet/crush/blob/7944b8e52225d8805e31eacbf7ef24856b0dfb7a/internal/cmd/run.go#L642-L678","documentation":"validateModelMatches (internal/cmd/run.go:660) returns this error when the given model ID matches models in more than one enabled provider, making the selection ambiguous. Crush requires disambiguation via the 'provider/model' syntax since model IDs are only unique within a provider.","triggerScenarios":"--model or --small-model given as a bare model ID (no '/'); two or more enabled providers each list a model whose ID matches case-insensitively; validateModelMatches receives len(matches) > 1.","commonSituations":"Common IDs shared across providers (e.g. 'gpt-4o' via OpenAI and OpenRouter, 'claude-3-5-sonnet' via Anthropic and Bedrock); multiple gateways configured for the same upstream model; newly added provider duplicating an existing model ID.","solutions":["Re-run with the qualified form: --model \"provider/model\" (e.g. \"openai/gpt-4o\")","Use the provider names listed in the error message to pick the intended one","Disable the duplicate/unwanted provider in config if you never use it","Run `crush models` to see which providers offer the model"],"exampleFix":"// before\ncrush run --model \"gpt-4o\"\n// error: found in multiple providers: openai, openrouter\n// after\ncrush run --model \"openai/gpt-4o\"","handlingStrategy":"validation","validationCode":"// Count providers offering the bare model ID before invoking\nmatches := 0\nfor name, p := range providers {\n\tif p.Disable {\n\t\tcontinue\n\t}\n\tfor _, m := range p.Models {\n\t\tif strings.EqualFold(m.ID, modelID) {\n\t\t\tmatches++\n\t\t}\n\t}\n}\nif matches > 1 && !strings.Contains(modelID, \"/\") {\n\tmodelID = preferredProvider + \"/\" + modelID\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Habitually use qualified 'provider/model' format in all automation","Disable unused duplicate providers/gateways in config","Pin models per provider in CI to avoid ambiguity from newly added providers","Treat the error's provider list as the source of truth for disambiguation"],"tags":["model-selection","ambiguity","cli","config"],"backgroundTag":"ambiguous-model-id","analyzedSha":"7944b8e52225d8805e31eacbf7ef24856b0dfb7a","analyzedAt":"2026-08-29T12:48:59.079Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}