{"record":{"id":"a6ff757e0a431b47","repo":"deepseek-ai/deepseek-harness","slug":"exit-plan-mode-requires-a-non-empty-markdown-plan","errorCode":null,"errorMessage":"exit_plan_mode requires a non-empty markdown plan starting with a # heading","messagePattern":"exit_plan_mode requires a non-empty markdown plan starting with a # heading","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/plan/plan-mode/src/index.ts","lineNumber":365,"sourceCode":"      },\n      output: {\n        schema: {\n          type: 'object',\n          additionalProperties: false,\n          properties: {\n            approved: { type: 'boolean', const: true, required: true },\n          },\n        },\n        render: () => [{ type: 'text', text: 'Plan approved — plan mode exited; carry out the plan starting with your next step.' }],\n      },\n      execute: async (args, exec) => {\n        const agent = exec.agent\n        if (agent === undefined) throw new Error(`${EXIT_PLAN_MODE} requires a calling agent (no session to switch)`)\n        if (!foldPlanMode(agent.session.events)) {\n          throw new Error(`${EXIT_PLAN_MODE} is only available in plan mode`)\n        }\n        if (!/^#\\s+\\S/.test(args.plan.trim())) {\n          throw new Error(`${EXIT_PLAN_MODE} requires a non-empty markdown plan starting with a # heading`)\n        }\n        const interaction = ctx.get('userQuestions')\n        if (interaction === undefined) {\n          throw new Error('no user-questions channel is available to review the plan; ask the user to switch the session mode instead')\n        }\n        const answer = await interaction.ask({\n          questions: [{\n            id: REVIEW_ID,\n            header: 'Plan review',\n            question: 'Approve this plan and leave plan mode?',\n            detail: args.plan,\n            options: [\n              { label: APPROVE_LABEL, description: 'Leave plan mode; the plan is carried out from the next step.' },\n              { label: KEEP_PLANNING_LABEL, description: 'Stay in plan mode; feedback goes back to the model.' },\n            ],\n            // Presentation only: a capable UI renders the plan as a review\n            // decision instead of a generic question, and answers with one of\n            // the labels above either way.","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/plan/plan-mode/src/index.ts#L347-L383","documentation":"Error \"exit_plan_mode requires a non-empty markdown plan starting with a # heading\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/plan/plan-mode/src/index.ts:365 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a non-empty markdown plan that starts with a # heading."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}