{"record":{"id":"6c33f2e8f50514f5","repo":"charmbracelet/crush","slug":"s-model-provider-q-not-found-in-configuration","errorCode":null,"errorMessage":"%s model: provider %q not found in configuration. Use 'crush models' to list available models","messagePattern":"(.+?) model: provider %q not found in configuration\\. Use 'crush models' to list available models","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/app/provider.go","lineNumber":48,"sourceCode":"type modelMatch struct {\n\tprovider string\n\tmodelID  string\n}\n\nfunc findModels(providers map[string]config.ProviderConfig, largeModel, smallModel string) ([]modelMatch, []modelMatch, error) {\n\tlargeProviderFilter, largeModelID := parseModelStr(providers, largeModel)\n\tsmallProviderFilter, smallModelID := parseModelStr(providers, smallModel)\n\n\t// Validate provider filters exist.\n\tfor _, pf := range []struct {\n\t\tfilter, label string\n\t}{\n\t\t{largeProviderFilter, \"large\"},\n\t\t{smallProviderFilter, \"small\"},\n\t} {\n\t\tif pf.filter != \"\" {\n\t\t\tif _, ok := providers[pf.filter]; !ok {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"%s model: provider %q not found in configuration. Use 'crush models' to list available models\", pf.label, pf.filter)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Find matching models in a single pass.\n\tvar largeMatches, smallMatches []modelMatch\n\tfor name, provider := range providers {\n\t\tif provider.Disable {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, m := range provider.Models {\n\t\t\tif filter(largeModelID, largeProviderFilter, m.ID, name) {\n\t\t\t\tlargeMatches = append(largeMatches, modelMatch{provider: name, modelID: m.ID})\n\t\t\t}\n\t\t\tif filter(smallModelID, smallProviderFilter, m.ID, name) {\n\t\t\t\tsmallMatches = append(smallMatches, modelMatch{provider: name, modelID: m.ID})\n\t\t\t}\n\t\t}","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/charmbracelet/crush/blob/7944b8e52225d8805e31eacbf7ef24856b0dfb7a/internal/app/provider.go#L30-L66","documentation":"When overriding models for non-interactive runs, findModels treats a non-empty provider filter as a provider name that must exist in the configured providers map. If the filter (e.g. 'anthropic') is not a configured provider, it fails fast with this error before attempting model matching.","triggerScenarios":"Passing --model or equivalent flags with 'provider/model' or a provider value whose provider section is absent from the config; calling overrideModelsForNonInteractive with largeProviderFilter/smallProviderFilter not present in providers map.","commonSituations":"Typo in provider name; provider defined in a different config file than the one loaded; provider removed after a config migration; using a model string without having configured that provider at all.","solutions":["Add the provider to your crushrc with its API key/config","Fix the provider name in the flag/argument (check spelling)","Run 'crush models' to list actually configured providers"],"exampleFix":"// before\ncrush run --model anthropic/claude-3   # provider 'anthropic' not in config\n// after\ncrush run --model openai/gpt-4o       # openai is configured\n# or add: provider \"anthropic\" api_key_env \"ANTHROPIC_API_KEY\"","handlingStrategy":"validation","validationCode":"providers := config.Providers()\nif _, ok := providers[requestedProvider]; !ok {\n    return fmt.Errorf(\"provider %q not configured; run 'crush models' to list providers\", requestedProvider)\n}","typeGuard":null,"tryCatchPattern":"matches, _, err := overrideModelsForNonInteractive(...)\nif err != nil && strings.Contains(err.Error(), \"not found in configuration\") {\n    return fmt.Errorf(\"bad --model flag: %w\", err)\n}","preventionTips":["Always use 'provider/model' qualified model strings in scripts","Keep provider config in the repo's crushrc so it loads everywhere","Run 'crush models' before scripting against a provider"],"tags":["config","provider","cli"],"backgroundTag":"provider-not-configured","analyzedSha":"7944b8e52225d8805e31eacbf7ef24856b0dfb7a","analyzedAt":"2026-08-29T12:48:59.079Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}