charmbracelet/crush · error
failed to set small model: %w
Error message
failed to set small model: %w
What it means
overrideModels (internal/cmd/run.go:524) wraps an error from c.UpdatePreferredModel when setting the small model explicitly supplied via --small-model. Same write-failure family as the large-model variant, but for SelectedModelTypeSmall.
Source
Thrown at internal/cmd/run.go:524
Provider: found.provider,
Model: found.modelID,
}); err != nil {
return fmt.Errorf("failed to set large model: %w", err)
}
}
switch {
case smallModel != "":
found, err := validateModelMatches(smallMatches, smallModel, "small")
if err != nil {
return err
}
slog.Info("Overriding small model", "provider", found.provider, "model", found.modelID)
if err := c.UpdatePreferredModel(ctx, ws.ID, config.ScopeWorkspace, config.SelectedModelTypeSmall, config.SelectedModel{
Provider: found.provider,
Model: found.modelID,
}); err != nil {
return fmt.Errorf("failed to set small model: %w", err)
}
case largeModel != "":
sm, err := c.GetDefaultSmallModel(ctx, ws.ID, largeProviderID)
if err != nil {
slog.Warn("Failed to get default small model", "error", err)
} else if sm != nil {
if err := c.UpdatePreferredModel(ctx, ws.ID, config.ScopeWorkspace, config.SelectedModelTypeSmall, *sm); err != nil {
return fmt.Errorf("failed to set small model: %w", err)
}
}
}
return c.UpdateAgent(ctx, ws.ID)
}
// restoreModelFromSession reads the last assistant message in the
// session and, if it used a different provider/model than the currentView on GitHub (pinned to 7944b8e522)
Solutions
- Inspect the wrapped cause (network vs HTTP status)
- Retry the command
- Confirm the small model is valid and enabled in the provider config
- Check auth and workspace permissions
- Check server logs for the failing request
Defensive patterns
Strategy: retry
Try / catch
if err := runNonInteractive(...); err != nil {
if strings.Contains(err.Error(), "failed to set small model") {
// unwrap and classify; retry transient failures
}
} Prevention
- Verify the small model ID exists in the provider's model list
- Run with stable network for multi-step config updates
- Check server logs if writes repeatedly fail
- Confirm workspace write permissions for the token
When it happens
Trigger: --small-model given and matched exactly one provider model; the subsequent c.UpdatePreferredModel(..., SelectedModelTypeSmall, ...) call fails (network error, HTTP 4xx/5xx, canceled context).
Common situations: Server rejects the provider/model for small-model use; transient network drop; expired credentials; workspace config locked by another writer.
Related errors
- failed to set large model: %w
- failed to get config: %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/35cd9774e49229f5.
Report an issue: GitHub.