charmbracelet/crush · error
configuration not found
Error message
configuration not found
What it means
Crush's TUI returns this Bubble Tea message when the user toggles the 'think' mode command but the app's config service returns nil (m.com.Config()). Config is a service that should always be loaded by app startup; a nil value means the UI command is running before/after config lifecycle exists.
Source
Thrown at internal/ui/model/ui.go:1986
editorValue := m.textarea.Value()
if m.bangMode {
editorValue = "!" + editorValue
}
cmds = append(cmds, m.openEditor(editorValue))
m.dialog.CloseDialog(dialog.CommandsID)
case dialog.ActionToggleCompactMode:
cmds = append(cmds, m.toggleCompactMode())
m.dialog.CloseDialog(dialog.CommandsID)
case dialog.ActionTogglePills:
if cmd := m.togglePillsExpanded(); cmd != nil {
cmds = append(cmds, cmd)
}
m.dialog.CloseDialog(dialog.CommandsID)
case dialog.ActionToggleThinking:
cmds = append(cmds, m.updateAgentModelCmd(func() tea.Msg {
cfg := m.com.Config()
if cfg == nil {
return util.ReportError(errors.New("configuration not found"))()
}
agentCfg, ok := cfg.Agents[config.AgentCoder]
if !ok {
return util.ReportError(errors.New("agent configuration not found"))()
}
currentModel := cfg.Models[agentCfg.Model]
currentModel.Think = !currentModel.Think
if err := m.com.Workspace.UpdatePreferredModel(config.ScopeGlobal, agentCfg.Model, currentModel); err != nil {
return util.ReportError(err)()
}
m.com.Workspace.UpdateAgentModel(context.TODO())
status := "disabled"
if currentModel.Think {
status = "enabled"
}
return util.NewInfoMsg("Thinking mode " + status)View on GitHub (pinned to 7944b8e522)
Solutions
- Check why config loading failed at startup (bad crushrc / crush.json) and fix the config file
- Verify m.com is fully initialized before the TUI processes dialog actions
- Report as a bug if config was valid — nil config in a running TUI is an internal invariant violation
Example fix
// before
cfg := m.com.Config()
if cfg == nil {
return util.ReportError(errors.New("configuration not found"))()
}
// after
if err := m.com.EnsureConfigLoaded(ctx); err != nil {
return util.ReportError(err)()
}
cfg := m.com.Config() Defensive patterns
Strategy: validation
Validate before calling
if cfg := m.com.Config(); cfg == nil {
// skip the toggle or surface a warning instead of dispatching
} Type guard
func configReady(m *Model) bool { return m.com != nil && m.com.Config() != nil } Try / catch
if cfg == nil {
return util.ReportError(fmt.Errorf("toggle thinking: %w", config.ErrNotLoaded))()
} Prevention
- Check config load errors at app startup and surface them immediately
- Disable config-dependent dialog actions until config is loaded
- Log the original load failure so 'configuration not found' is traceable
When it happens
Trigger: Invoking dialog.ActionToggleThinking (the toggle-thinking command dialog entry) while m.com.Config() returns nil — e.g. config failed to load at startup, or the command fires during teardown/shutdown when the config service has been cleared.
Common situations: Corrupt or unreadable crushrc/crush.json that aborted config loading; racing the TUI before app wiring completes; running the command in a test harness that constructed the model without a config service.
Related errors
- agent configuration not found
- Crush crashed. If metrics are enabled, we were notified abou
- agent configuration not found
- model configuration not found
- no reasoning levels available
AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29).
Data as JSON: /api/errors/eea3a7e4dcd8cb22.
Report an issue: GitHub.