{"record":{"id":"84f172f2cd6ba9e4","repo":"charmbracelet/crush","slug":"failed-to-set-large-model-w","errorCode":null,"errorMessage":"failed to set large model: %w","messagePattern":"failed to set large model: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/run.go","lineNumber":509,"sourceCode":"\n\tproviders := cfg.Providers.Copy()\n\n\tlargeMatches, smallMatches := findModelMatches(providers, largeModel, smallModel)\n\n\tvar largeProviderID string\n\n\tif largeModel != \"\" {\n\t\tfound, err := validateModelMatches(largeMatches, largeModel, \"large\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlargeProviderID = found.provider\n\t\tslog.Info(\"Overriding large model\", \"provider\", found.provider, \"model\", found.modelID)\n\t\tif err := c.UpdatePreferredModel(ctx, ws.ID, config.ScopeWorkspace, config.SelectedModelTypeLarge, config.SelectedModel{\n\t\t\tProvider: found.provider,\n\t\t\tModel:    found.modelID,\n\t\t}); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to set large model: %w\", err)\n\t\t}\n\t}\n\n\tswitch {\n\tcase smallModel != \"\":\n\t\tfound, err := validateModelMatches(smallMatches, smallModel, \"small\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tslog.Info(\"Overriding small model\", \"provider\", found.provider, \"model\", found.modelID)\n\t\tif err := c.UpdatePreferredModel(ctx, ws.ID, config.ScopeWorkspace, config.SelectedModelTypeSmall, config.SelectedModel{\n\t\t\tProvider: found.provider,\n\t\t\tModel:    found.modelID,\n\t\t}); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to set small model: %w\", err)\n\t\t}\n\n\tcase largeModel != \"\":","sourceCodeStart":491,"sourceCodeEnd":527,"githubUrl":"https://github.com/charmbracelet/crush/blob/7944b8e52225d8805e31eacbf7ef24856b0dfb7a/internal/cmd/run.go#L491-L527","documentation":"overrideModels (internal/cmd/run.go:509) wraps an error from c.UpdatePreferredModel when persisting the user's --model override (large model) into workspace config. The model string already validated and matched a provider; the failure is in the server-side write.","triggerScenarios":"After validateModelMatches succeeds for the large model, c.UpdatePreferredModel(ctx, ws.ID, ScopeWorkspace, SelectedModelTypeLarge, SelectedModel{...}) returns an error: network failure, HTTP error, validation rejection server-side, or canceled context.","commonSituations":"Server rejects the selected provider/model combination; concurrent config update conflicts; expired auth; connection dropped mid-request; server bug returning 5xx on UpdatePreferredClodel.","solutions":["Read the wrapped error to see whether it is a network or HTTP-level failure","Retry the command — the write may have failed transiently","Verify the provider is enabled and the model still exists server-side","Check auth credentials and workspace permissions","Inspect server logs for the UpdatePreferredModel request"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := runNonInteractive(...); err != nil {\n\tif strings.Contains(err.Error(), \"failed to set large model\") {\n\t\t// inspect errors.Unwrap(err); retry with backoff on network errors\n\t}\n}","preventionTips":["Validate the model string resolves (via `crush models`) before running","Ensure stable connectivity for config writes","Avoid concurrent writers mutating the same workspace config","Keep auth tokens fresh in automation"],"tags":["network","http","config","model-selection","go"],"backgroundTag":"config-write-failed","analyzedSha":"7944b8e52225d8805e31eacbf7ef24856b0dfb7a","analyzedAt":"2026-08-29T12:48:59.079Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}