{"record":{"id":"5bf368dde94b5ee8","repo":"charmbracelet/crush","slug":"agent-configuration-not-found-5bf368","errorCode":null,"errorMessage":"agent configuration not found","messagePattern":"agent configuration not found","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/ui/model/ui.go","lineNumber":1991,"sourceCode":"\t\tm.dialog.CloseDialog(dialog.CommandsID)\n\tcase dialog.ActionToggleCompactMode:\n\t\tcmds = append(cmds, m.toggleCompactMode())\n\t\tm.dialog.CloseDialog(dialog.CommandsID)\n\tcase dialog.ActionTogglePills:\n\t\tif cmd := m.togglePillsExpanded(); cmd != nil {\n\t\t\tcmds = append(cmds, cmd)\n\t\t}\n\t\tm.dialog.CloseDialog(dialog.CommandsID)\n\tcase dialog.ActionToggleThinking:\n\t\tcmds = append(cmds, m.updateAgentModelCmd(func() tea.Msg {\n\t\t\tcfg := m.com.Config()\n\t\t\tif cfg == nil {\n\t\t\t\treturn util.ReportError(errors.New(\"configuration not found\"))()\n\t\t\t}\n\n\t\t\tagentCfg, ok := cfg.Agents[config.AgentCoder]\n\t\t\tif !ok {\n\t\t\t\treturn util.ReportError(errors.New(\"agent configuration not found\"))()\n\t\t\t}\n\n\t\t\tcurrentModel := cfg.Models[agentCfg.Model]\n\t\t\tcurrentModel.Think = !currentModel.Think\n\t\t\tif err := m.com.Workspace.UpdatePreferredModel(config.ScopeGlobal, agentCfg.Model, currentModel); err != nil {\n\t\t\t\treturn util.ReportError(err)()\n\t\t\t}\n\t\t\tm.com.Workspace.UpdateAgentModel(context.TODO())\n\t\t\tstatus := \"disabled\"\n\t\t\tif currentModel.Think {\n\t\t\t\tstatus = \"enabled\"\n\t\t\t}\n\t\t\treturn util.NewInfoMsg(\"Thinking mode \" + status)\n\t\t}))\n\t\tm.dialog.CloseDialog(dialog.CommandsID)\n\tcase dialog.ActionToggleTransparentBackground:\n\t\tcmds = append(cmds, func() tea.Msg {\n\t\t\tcfg := m.com.Config()","sourceCodeStart":1973,"sourceCodeEnd":2009,"githubUrl":"https://github.com/charmbracelet/crush/blob/7944b8e52225d8805e31eacbf7ef24856b0dfb7a/internal/ui/model/ui.go#L1973-L2009","documentation":"Thrown when config exists but cfg.Agents has no entry for config.AgentCoder. The toggle-thinking flow requires the default 'coder' agent to be defined; a config that omits or renames it cannot resolve which model to flip thinking on.","triggerScenarios":"Executing ActionToggleThinking with a config whose Agents map lacks the 'coder' key — e.g. a user-defined agents block that only defines a 'task' agent, or a typo'd/overridden agent name in crushrc.","commonSituations":"Hand-edited crushrc/crush.json that removed the coder agent; older config versions migrated without the default agent; partial config merges dropping the agent definition.","solutions":["Add back the default 'coder' agent definition to your config","Run config validation (crush doctor / startup validation) to catch missing required agents","Update the config to the current schema if it was written by an older Crush version"],"exampleFix":"// before (agents without coder)\n[agents.task]\nmodel = \"anthropic/claude-sonnet-4\"\n// after\n[agents.coder]\nmodel = \"anthropic/claude-sonnet-4\"\n[agents.task]\nmodel = \"anthropic/claude-sonnet-4\"","handlingStrategy":"validation","validationCode":"cfg := m.com.Config()\nif cfg == nil || cfg.Agents == nil {\n\treturn // cannot toggle thinking\n}\nif _, ok := cfg.Agents[config.AgentCoder]; !ok {\n\treturn // coder agent missing\n}","typeGuard":"func coderAgent(cfg *config.Config) (config.AgentConfig, bool) {\n\ta, ok := cfg.Agents[config.AgentCoder]\n\treturn a, ok\n}","tryCatchPattern":"agentCfg, ok := cfg.Agents[config.AgentCoder]\nif !ok {\n\treturn util.ReportError(fmt.Errorf(\"toggle thinking: agent %q not configured\", config.AgentCoder))()\n}","preventionTips":["Keep the default coder agent in your config when customizing agents","Run config validation on startup","Diff your config against the current schema after upgrading Crush"],"tags":["tui","config","agent","go"],"backgroundTag":"missing-agent-config","analyzedSha":"7944b8e52225d8805e31eacbf7ef24856b0dfb7a","analyzedAt":"2026-08-29T12:48:59.079Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}