deepseek-ai/deepseek-harness · error
exit_plan_mode is only available in plan mode
Error message
exit_plan_mode is only available in plan mode
What it means
Tool-execution guard on exit_plan_mode: the calling session is not currently in plan mode (the folded session state says plan mode is off). The tool only performs its state switch while plan mode is active.
Solutions
- Enter plan mode before calling exit_plan_mode.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/plan/plan-mode/src/index.ts:362 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24).
Data as JSON: /api/errors/57463653dd611cc3.
Report an issue: GitHub.
Appendix: source
Thrown at packages/plan/plan-mode/src/index.ts:362
description: EXIT_DESCRIPTION,
parameters: {
plan: { type: 'string', required: true, description: 'The complete plan, as markdown, starting with a # heading that names it.' },
},
output: {
schema: {
type: 'object',
additionalProperties: false,
properties: {
approved: { type: 'boolean', const: true, required: true },
},
},
render: () => [{ type: 'text', text: 'Plan approved — plan mode exited; carry out the plan starting with your next step.' }],
},
execute: async (args, exec) => {
const agent = exec.agent
if (agent === undefined) throw new Error(`${EXIT_PLAN_MODE} requires a calling agent (no session to switch)`)
if (!foldPlanMode(agent.session.events)) {
throw new Error(`${EXIT_PLAN_MODE} is only available in plan mode`)
}
if (!/^#\s+\S/.test(args.plan.trim())) {
throw new Error(`${EXIT_PLAN_MODE} requires a non-empty markdown plan starting with a # heading`)
}
const interaction = ctx.get('userQuestions')
if (interaction === undefined) {
throw new Error('no user-questions channel is available to review the plan; ask the user to switch the session mode instead')
}
const answer = await interaction.ask({
questions: [{
id: REVIEW_ID,
header: 'Plan review',
question: 'Approve this plan and leave plan mode?',
detail: args.plan,
options: [
{ label: APPROVE_LABEL, description: 'Leave plan mode; the plan is carried out from the next step.' },
{ label: KEEP_PLANNING_LABEL, description: 'Stay in plan mode; feedback goes back to the model.' },
],View on GitHub (pinned to b150a551b8)