{"record":{"id":"eea3a7e4dcd8cb22","repo":"charmbracelet/crush","slug":"configuration-not-found","errorCode":null,"errorMessage":"configuration not found","messagePattern":"configuration not found","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/ui/model/ui.go","lineNumber":1986,"sourceCode":"\t\teditorValue := m.textarea.Value()\n\t\tif m.bangMode {\n\t\t\teditorValue = \"!\" + editorValue\n\t\t}\n\t\tcmds = append(cmds, m.openEditor(editorValue))\n\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)","sourceCodeStart":1968,"sourceCodeEnd":2004,"githubUrl":"https://github.com/charmbracelet/crush/blob/7944b8e52225d8805e31eacbf7ef24856b0dfb7a/internal/ui/model/ui.go#L1968-L2004","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\ncfg := m.com.Config()\nif cfg == nil {\n\treturn util.ReportError(errors.New(\"configuration not found\"))()\n}\n// after\nif err := m.com.EnsureConfigLoaded(ctx); err != nil {\n\treturn util.ReportError(err)()\n}\ncfg := m.com.Config()","handlingStrategy":"validation","validationCode":"if cfg := m.com.Config(); cfg == nil {\n\t// skip the toggle or surface a warning instead of dispatching\n}","typeGuard":"func configReady(m *Model) bool { return m.com != nil && m.com.Config() != nil }","tryCatchPattern":"if cfg == nil {\n\treturn util.ReportError(fmt.Errorf(\"toggle thinking: %w\", config.ErrNotLoaded))()\n}","preventionTips":["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"],"tags":["tui","config","go"],"backgroundTag":"config-not-loaded","analyzedSha":"7944b8e52225d8805e31eacbf7ef24856b0dfb7a","analyzedAt":"2026-08-29T12:48:59.079Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}