can1357/oh-my-pi · error · ToolError
Goal mode is not active.
Error message
Goal mode is not active.
What it means
The goal tool delegates to a goal runtime fetched from the session via session.getGoalRuntime?.(). When the runtime is absent — goal mode was never activated or has been disabled — execute throws this ToolError instead of performing any operation.
Source
Thrown at packages/coding-agent/src/goals/tools/goal-tool.ts:80
readonly parameters = goalSchema;
readonly strict = true;
readonly intent = "omit" as const;
readonly #session: ToolSession;
constructor(session: ToolSession) {
this.#session = session;
}
async execute(
_toolCallId: string,
params: GoalToolInput,
_signal?: AbortSignal,
_onUpdate?: AgentToolUpdateCallback<GoalToolDetails>,
_context?: AgentToolContext,
): Promise<AgentToolResult<GoalToolDetails>> {
const runtime = this.#session.getGoalRuntime?.();
if (!runtime) {
throw new ToolError("Goal mode is not active.");
}
let response: GoalToolResponse;
if (params.op === "create") {
const created = await runtime.createGoal(validateCreateParams(params));
response = buildGoalToolResponse(created.goal);
} else if (params.op === "get") {
const state = this.#session.getGoalModeState?.();
response = buildGoalToolResponse(state?.goal ?? null);
} else if (params.op === "resume") {
const resumed = await runtime.resumeGoal();
response = buildGoalToolResponse(resumed.goal);
} else if (params.op === "drop") {
const dropped = await runtime.dropGoal();
response = buildGoalToolResponse(dropped ?? null);
} else {
const completed = await runtime.completeGoalFromTool();
response = buildGoalToolResponse(completed, { includeCompletionReport: true });View on GitHub (pinned to 9690622007)
Solutions
- Enable goal mode for the session before using the goal tool
- Verify the session was constructed with a goal runtime (getGoalRuntime returns one)
- Guard tool availability: only expose/register the goal tool when goal mode is active
Defensive patterns
Strategy: try-catch
Validate before calling
const runtime = session.getGoalRuntime?.();
if (!runtime) throw new Error("Enable goal mode before calling the goal tool"); Type guard
function goalModeActive(s: Session): boolean {
return typeof s.getGoalRuntime === "function" && s.getGoalRuntime() != null;
} Try / catch
try {
await goalTool.execute(params, _sig, _signal, _onUpdate, ctx);
} catch (err) {
if (err instanceof ToolError && err.message === "Goal mode is not active.") {
// surface guidance to enable goal mode, don't retry blindly
} else throw err;
} Prevention
- Only register/expose the goal tool in sessions where goal mode is on
- Check getGoalRuntime() availability before planning goal tool calls
- Document goal-mode prerequisite in agent prompts
When it happens
Trigger: Invoking the `goal` tool (any op: create/update/status) in a session where goal mode is not active, e.g. the session wasn't started with goal mode enabled or the runtime was not installed on the session.
Common situations: Agent tries to use the goal tool in a normal (non-goal-mode) run; configuration toggles goal mode off; embedding the agent SDK without wiring a GoalRuntime onto the session.
Related errors
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/e32ebfc46b7db2b1.
Report an issue: GitHub.