{"record":{"id":"2e581399232ea04c","repo":"charmbracelet/crush","slug":"failed-to-override-models-w-2e5813","errorCode":null,"errorMessage":"failed to override models: %w","messagePattern":"failed to override models: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/run.go","lineNumber":189,"sourceCode":"// runNonInteractive executes the agent via the server and streams output\n// to stdout.\nfunc runNonInteractive(\n\tctx context.Context,\n\tc *client.Client,\n\tws *proto.Workspace,\n\tprompt, largeModel, smallModel string,\n\thideSpinner bool,\n\tcontinueSessionID string,\n\tuseLast bool,\n) error {\n\tslog.Info(\"Running in non-interactive mode\")\n\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\tif largeModel != \"\" || smallModel != \"\" {\n\t\tif err := overrideModels(ctx, c, ws, largeModel, smallModel); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to override models: %w\", err)\n\t\t}\n\t}\n\n\tvar (\n\t\tspinner   *format.Spinner\n\t\tstderrTTY bool\n\t\tprogress  bool\n\t)\n\n\tstderrTTY = term.IsTerminal(os.Stderr.Fd())\n\tprogress = ws.Config.Options.Progress == nil || *ws.Config.Options.Progress\n\n\tif !hideSpinner && stderrTTY {\n\t\tt := styles.ThemeForProvider(ws.Config.Models[config.SelectedModelTypeLarge].Provider)\n\n\t\tspinner = format.NewSpinner(ctx, cancel, anim.Settings{\n\t\t\tSize:        10,\n\t\t\tLabel:       \"Generating\",","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/charmbracelet/crush/blob/7944b8e52225d8805e31eacbf7ef24856b0dfb7a/internal/cmd/run.go#L171-L207","documentation":"Wraps errors from overrideModels(), which applies --model/--large-model/--small-model CLI overrides to the workspace before the run. The wrapped error indicates the requested model/provider could not be applied.","triggerScenarios":"Running `crush run --model provider/model` (or large/small variants) where overrideModels(ctx, c, ws, largeModel, smallModel) fails — usually an invalid model id or unknown provider.","commonSituations":"Typo in `provider/model` id; model removed or renamed in the model catalog; model belongs to a provider that has no credentials configured; model string missing the provider prefix.","solutions":["Check the exact model id with `crush models` and use provider/model format","Ensure the provider of the overridden model is configured with credentials","Update crush so the model catalog is current (catwalk snapshot refresh)","Remove the --model flag to fall back to configured defaults"],"exampleFix":"// before\ncrush run --model claude-sonnet-4 \"fix the bug\"\n// after\ncrush run --model anthropic/claude-sonnet-4 \"fix the bug\"","handlingStrategy":"validation","validationCode":"// verify model id format and availability before overriding\nif largeModel != \"\" && !strings.Contains(largeModel, \"/\") {\n\treturn fmt.Errorf(\"--model must be in provider/model form, got %q\", largeModel)\n}\nif !modelCatalog.Contains(largeModel) {\n\treturn fmt.Errorf(\"unknown model %q; run `crush models` to list ids\", largeModel)\n}","typeGuard":null,"tryCatchPattern":"if err := overrideModels(ctx, c, ws, largeModel, smallModel); err != nil {\n\treturn fmt.Errorf(\"failed to override models: %w (run `crush models` for valid ids)\", err)\n}","preventionTips":["Always use the full provider/model id form (e.g. anthropic/claude-sonnet-4)","Confirm ids with `crush models` before scripting","Pin model ids in scripts and update them when the catalog changes"],"tags":["go","cli","model-override","config"],"backgroundTag":"invalid-model-override","analyzedSha":"7944b8e52225d8805e31eacbf7ef24856b0dfb7a","analyzedAt":"2026-08-29T12:48:59.079Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}