Skip to content

Errors

Check errors with errors.Is; crux wraps them with context.

SentinelWhenWhat to do
crux.ErrApprovalNeededA tool call waits for a human.PendingApprovals, Approve/Reject, Resume. See approvals.md.
crux.ErrMaxTurnsThe agent used WithMaxTurns requests without answering.Raise the limit or tighten the instructions; Resume continues.
crux.ErrRefusedThe model refused.Show the user; rephrasing may help.
crux.ErrOutputValidationThe answer doesn’t match the output schema.WithMaxRepairs(n); simplify the schema.
crux.ErrContextTooLongThe request exceeds the context window even after compaction.Fork or start a new session; send less.
crux.ErrToolNotFoundAn agent names a tool or toolset nobody registered (from crux.New).Register it before building the agent.
crux.ErrSessionNotFoundA Store has no entries for an ID.NewSession with WithSessionID already handles this by starting fresh.
crux.ErrSessionConflictAnother writer appended to the session first.Reopen with WithSessionID and retry.

Tool errors are not here: they go to the model, not to you (tools.md). Provider and network errors are returned as they are; after any error, Resume retries without repeating the input.