charmbracelet/crush · error

agent configuration not found

Error message

agent configuration not found

What it means

The Reasoning dialog builds its items from the app config. It throws this error when cfg.Agents has no entry for the 'coder' agent (config.AgentCoder), meaning the required coder agent is not configured at all.

Source

Thrown at internal/ui/dialog/reasoning.go:241

	m := [][]key.Binding{}
	slice := []key.Binding{
		r.keyMap.Select,
		r.keyMap.Next,
		r.keyMap.Previous,
		r.keyMap.Close,
	}
	for i := 0; i < len(slice); i += 4 {
		end := min(i+4, len(slice))
		m = append(m, slice[i:end])
	}
	return m
}

func (r *Reasoning) setReasoningItems() error {
	cfg := r.com.Config()
	agentCfg, ok := cfg.Agents[config.AgentCoder]
	if !ok {
		return errors.New("agent configuration not found")
	}

	selectedModel := cfg.Models[agentCfg.Model]
	model := cfg.GetModelByType(agentCfg.Model)
	if model == nil {
		return errors.New("model configuration not found")
	}

	if len(model.ReasoningLevels) == 0 {
		return errors.New("no reasoning levels available")
	}

	currentEffort := selectedModel.ReasoningEffort
	if currentEffort == "" {
		currentEffort = model.DefaultReasoningEffort
	}

	items := make([]list.FilterableItem, 0, len(model.ReasoningLevels))

View on GitHub (pinned to 7944b8e522)

Solutions

  1. Restore the 'coder' agent definition in the config (crushrc `agent` builtin or crush.json agents map)
  2. Fix the agent name typo so the key is exactly `coder`
  3. Regenerate or reset to a default config that includes the coder agent

Example fix

// before (crushrc)
agent task
// after
agent coder
agent task
Defensive patterns

Strategy: fallback

Validate before calling

if _, ok := cfg.Agents[config.AgentCoder]; !ok {
	// repair config or skip dialog
}

Type guard

func hasCoderAgent(cfg *config.Config) bool {
	_, ok := cfg.Agents[config.AgentCoder]
	return ok
}

Try / catch

if err := dialog.SetReasoningItems(); err != nil {
	// disable the reasoning dialog for this session
	dialog.SetEnabled(false)
}

Prevention

When it happens

Trigger: Opening the reasoning dialog (NewReasoning → setReasoningItems) with a config whose Agents map lacks the 'coder' key — e.g. a hand-edited config that removed or renamed the coder agent.

Common situations: Custom crushrc/config files that define only 'task' agents and drop 'coder'; typos in agent names; loading a partial/minimal config in tests.

Related errors


AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29). Data as JSON: /api/errors/46719b91d44968ea. Report an issue: GitHub.