{"record":{"id":"648dd3a36b54cbe9","repo":"charmbracelet/crush","slug":"s-model-q-not-found-648dd3","errorCode":null,"errorMessage":"%s model %q not found","messagePattern":"(.+?) model %q not found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/run.go","lineNumber":654,"sourceCode":"}\n\n// matchesModel returns true if the model ID matches the filter\n// criteria.\nfunc matchesModel(wantID, wantProvider, modelID, providerName string) bool {\n\tif wantID == \"\" {\n\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) {","sourceCodeStart":636,"sourceCodeEnd":672,"githubUrl":"https://github.com/charmbracelet/crush/blob/7944b8e52225d8805e31eacbf7ef24856b0dfb7a/internal/cmd/run.go#L636-L672","documentation":"validateModelMatches (internal/cmd/run.go:654) returns this error when findModelMatches found zero enabled providers offering a model matching the given --model or --small-model string. The match is case-insensitive on model ID across all non-disabled providers.","triggerScenarios":"runNonInteractive with --model/--small-model; after scanning all enabled providers' model lists, no model ID equals (case-insensitively) the requested ID, or the provider part of 'provider/model' does not match any configured provider name.","commonSituations":"Typo in the model ID; provider missing API key / disabled in config; model deprecated or renamed upstream; using a provider alias that is not the configured provider name; 'provider/model' string where provider part doesn't match.","solutions":["Run `crush models` to list available provider/model IDs and copy the exact ID","Fix typos — matching is case-insensitive but must otherwise be exact","Enable the provider and set its API key in config (crushrc `provider` / `model` builtins or crush.json)","If using 'provider/model', verify the provider name matches the configured provider key","Check whether the model was renamed/deprecated upstream and pick the successor"],"exampleFix":"// before\ncrush run --model \"anthropic/claude-sonnet-4-5\"\n// error: large model \"claude-sonnet-4-5\" not found\n// after: use exact ID from `crush models`\ncrush run --model \"anthropic/claude-sonnet-4-5-20250929\"","handlingStrategy":"validation","validationCode":"// Pre-validate the model string against provider config\n// (mirror of findModelMatches logic)\nfunc modelExists(providers map[string]config.ProviderConfig, s string) bool {\n\tprov, id := parseModelString(s)\n\tfor name, p := range providers {\n\t\tif p.Disable || (prov != \"\" && name != prov) {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, m := range p.Models {\n\t\t\tif strings.EqualFold(m.ID, id) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always source model IDs from `crush models` output","Use fully qualified 'provider/model' strings in scripts/CI","Check the provider is enabled and has an API key configured","Watch for upstream model deprecations/renames when pinning versions"],"tags":["model-selection","config","cli","validation"],"backgroundTag":"model-not-found","analyzedSha":"7944b8e52225d8805e31eacbf7ef24856b0dfb7a","analyzedAt":"2026-08-29T12:48:59.079Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}