{"record":{"id":"b92ba111274c7348","repo":"charmbracelet/crush","slug":"failed-to-get-config-w-b92ba1","errorCode":null,"errorMessage":"failed to get config: %w","messagePattern":"failed to get config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/run.go","lineNumber":489,"sourceCode":"\t\t\treturn fmt.Errorf(\"timeout waiting for agent readiness\")\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase <-time.After(200 * time.Millisecond):\n\t\t}\n\t}\n}\n\n// overrideModels resolves model strings and updates the workspace\n// configuration via the server.\nfunc overrideModels(\n\tctx context.Context,\n\tc *client.Client,\n\tws *proto.Workspace,\n\tlargeModel, smallModel string,\n) error {\n\tcfg, err := c.GetConfig(ctx, ws.ID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get config: %w\", err)\n\t}\n\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,","sourceCodeStart":471,"sourceCodeEnd":507,"githubUrl":"https://github.com/charmbracelet/crush/blob/7944b8e52225d8805e31eacbf7ef24856b0dfb7a/internal/cmd/run.go#L471-L507","documentation":"overrideModels (internal/cmd/run.go:489) wraps any error from c.GetConfig when fetching the workspace configuration via --model/--small-model overrides in the non-interactive run path. It indicates the server config could not be retrieved, so model overrides cannot be resolved.","triggerScenarios":"runNonInteractive is invoked with largeModel or smallModel set; c.GetConfig(ctx, ws.ID) fails due to network error, HTTP error (401/404/500), or canceled context.","commonSituations":"Server unreachable mid-run; workspace ID invalid; auth token expired; server returning 5xx; context deadline exceeded on a slow network.","solutions":["Check the wrapped cause to identify transport vs HTTP error","Verify server connectivity and authentication credentials","Confirm the workspace ID is correct and exists","Retry the command if the failure was transient","Check server logs for the corresponding request failure"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-flight: fetch config before issuing model overrides\ncfg, err := c.GetConfig(ctx, ws.ID)\nif err != nil {\n\treturn fmt.Errorf(\"pre-flight config check failed: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := overrideModels(ctx, c, ws, large, small); err != nil {\n\tvar unwrapped error\n\tif errors.As(err, &unwrapped) && strings.Contains(err.Error(), \"failed to get config\") {\n\t\t// handle connectivity/auth failure before retrying\n\t}\n}","preventionTips":["Verify server connectivity and auth before run","Confirm workspace ID validity early","Wrap long-running automations with context timeouts larger than startup cost","Retry transient network failures with backoff"],"tags":["network","config","http","go"],"backgroundTag":"config-fetch-failed","analyzedSha":"7944b8e52225d8805e31eacbf7ef24856b0dfb7a","analyzedAt":"2026-08-29T12:48:59.079Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}