charmbracelet/crush · critical
coder agent configuration is missing
Error message
coder agent configuration is missing
What it means
initCoderAgent requires a configured 'coder' agent entry in the loaded crush config before it can build the agent Coordinator. If the config's Agents map has no entry with a non-empty ID for config.AgentCoder, the app cannot start and returns this error. It is thrown during App initialization (both interactive and non-interactive paths).
Source
Thrown at internal/app/app.go:681
}
}
})
}
func (app *App) InitCoderAgent(ctx context.Context) error {
return app.initCoderAgent(ctx, true)
}
// InitCoderAgentNonInteractive initializes the coder agent without
// interactive-only tools (e.g. question).
func (app *App) InitCoderAgentNonInteractive(ctx context.Context) error {
return app.initCoderAgent(ctx, false)
}
func (app *App) initCoderAgent(ctx context.Context, interactive bool) error {
coderAgentCfg := app.config.Config().Agents[config.AgentCoder]
if coderAgentCfg.ID == "" {
return fmt.Errorf("coder agent configuration is missing")
}
var err error
app.AgentCoordinator, err = agent.NewCoordinator(ctx, agent.CoordinatorOptions{
Config: app.config,
Sessions: app.Sessions,
Messages: app.Messages,
Permissions: app.Permissions,
Questions: app.Questions,
History: app.History,
FileTracker: app.FileTracker,
LSPManager: app.LSPManager,
Notify: app.agentNotifications,
RunComplete: app.runCompletions,
Skills: app.Skills,
Interactive: interactive,
})
if err != nil {
slog.Error("Failed to create coder agent", "err", err)View on GitHub (pinned to 7944b8e522)
Solutions
- Add a 'coder' agent definition to your crushrc (or crush.json) with a valid ID and provider/model
- Run 'crush models' / login flow to generate default agent config
- Verify the config file being loaded is the one you edited (check working directory and CRUSH_CONFIG paths)
Example fix
// before (crushrc) provider anthropic # no agent defined // after provider anthropic agent coder model anthropic/claude-sonnet-4 end
Defensive patterns
Strategy: validation
Validate before calling
cfg := app.config.Config()
if cfg.Agents[config.AgentCoder].ID == "" {
return errors.New("no coder agent configured: add an 'agent coder' block to crushrc")
} Try / catch
if err := app.InitCoderAgent(ctx); err != nil {
if strings.Contains(err.Error(), "coder agent configuration is missing") {
// fall back to generating default config or prompt user to configure
}
return err
} Prevention
- Commit a crushrc with a coder agent definition to the repo
- Run the interactive 'crush' once after install to seed default agents
- Validate config at CI time before running non-interactive workflows
When it happens
Trigger: Calling InitCoderAgent or InitCoderAgentNonInteractive when app.config.Config().Agents[config.AgentCoder].ID is empty — i.e. the crushrc/crush.json defines no 'coder' agent, or the agent entry failed to parse/populate its ID.
Common situations: Fresh projects with no crushrc; a crushed/deleted agent block in the config; renaming the agent key so AgentCoder no longer resolves; config merge errors leaving the agents map empty.
Related errors
- coder agent not configured
- task agent not configured
- agent configuration not found
- failed to initialize coder agent: %w
- failed to initialize agent: %w
AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29).
Data as JSON: /api/errors/f08eafbb2e460951.
Report an issue: GitHub.