charmbracelet/crush · error
failed to get config: %w
Error message
failed to get config: %w
What it means
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.
Source
Thrown at internal/cmd/run.go:489
return fmt.Errorf("timeout waiting for agent readiness")
case <-ctx.Done():
return ctx.Err()
case <-time.After(200 * time.Millisecond):
}
}
}
// overrideModels resolves model strings and updates the workspace
// configuration via the server.
func overrideModels(
ctx context.Context,
c *client.Client,
ws *proto.Workspace,
largeModel, smallModel string,
) error {
cfg, err := c.GetConfig(ctx, ws.ID)
if err != nil {
return fmt.Errorf("failed to get config: %w", err)
}
providers := cfg.Providers.Copy()
largeMatches, smallMatches := findModelMatches(providers, largeModel, smallModel)
var largeProviderID string
if largeModel != "" {
found, err := validateModelMatches(largeMatches, largeModel, "large")
if err != nil {
return err
}
largeProviderID = found.provider
slog.Info("Overriding large model", "provider", found.provider, "model", found.modelID)
if err := c.UpdatePreferredModel(ctx, ws.ID, config.ScopeWorkspace, config.SelectedModelTypeLarge, config.SelectedModel{
Provider: found.provider,
Model: found.modelID,View on GitHub (pinned to 7944b8e522)
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
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-flight: fetch config before issuing model overrides
cfg, err := c.GetConfig(ctx, ws.ID)
if err != nil {
return fmt.Errorf("pre-flight config check failed: %w", err)
} Try / catch
if err := overrideModels(ctx, c, ws, large, small); err != nil {
var unwrapped error
if errors.As(err, &unwrapped) && strings.Contains(err.Error(), "failed to get config") {
// handle connectivity/auth failure before retrying
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Server unreachable mid-run; workspace ID invalid; auth token expired; server returning 5xx; context deadline exceeded on a slow network.
Related errors
- failed to set large model: %w
- failed to set small model: %w
- failed to read response: %w
- failed to set config field: %w
- failed to remove config field: %w
AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29).
Data as JSON: /api/errors/b92ba111274c7348.
Report an issue: GitHub.