{"record":{"id":"394199948dffecbf","repo":"plandex-ai/plandex","slug":"planningsharedmsgs-not-supported-during-implementa","errorCode":null,"errorMessage":"planningSharedMsgs not supported during implementation stage - only basic or smart context is supported","messagePattern":"planningSharedMsgs not supported during implementation stage - only basic or smart context is supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/server/model/plan/tell_sys_prompt.go","lineNumber":178,"sourceCode":"\t\t\t\tsysParts = append(sysParts, types.ExtendedChatMessagePart{\n\t\t\t\t\tType: openai.ChatMessagePartTypeText,\n\t\t\t\t\tText: skippedPrompt,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tif implementationMsgs != nil {\n\t\t\tfor _, msg := range implementationMsgs {\n\t\t\t\tsysParts = append(sysParts, *msg)\n\t\t\t}\n\t\t} else if !params.dryRunWithoutContext {\n\t\t\tlog.Println(\"implementationMsgs is nil - required for implementation stage\")\n\t\t\treturn nil, fmt.Errorf(\"implementationMsgs is nil - required for implementation stage\")\n\t\t}\n\n\t\tif planningSharedMsgs != nil {\n\t\t\tlog.Println(\"planningSharedMsgs not supported during implementation stage - only basic or smart context is supported\")\n\t\t\treturn nil, fmt.Errorf(\"planningSharedMsgs not supported during implementation stage - only basic or smart context is supported\")\n\t\t}\n\t}\n\n\treturn sysParts, nil\n}\n","sourceCodeStart":160,"sourceCodeEnd":184,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/model/plan/tell_sys_prompt.go#L160-L184","documentation":"getTellSysPrompt builds the system prompt for LLM plan-execution calls. When the plan is in the implementation stage it requires implementationMsgs (context built with 'basic' or 'smart' context mode) and forbids planningSharedMsgs, which only makes sense in the planning stage. If a planning-stage shared message slice is passed to an implementation-stage call, the function refuses to build a prompt and returns this error instead of silently producing a malformed prompt.","triggerScenarios":"Calling getTellSysPrompt (via execTellPlan or a dry-run token calculation dryRunCalculateTokensWithoutContext) with the current subtask in the implementation stage while the caller passes a non-nil planningSharedMsgs — i.e. the wrong context-construction path (planning shared context) was selected for an implementation-stage request.","commonSituations":"A context-mode mismatch: the plan moved from planning to implementation but the caller is still using context messages assembled for planning; custom context ('whole'/'file-map' style) configurations that produce shared planning messages; code paths or integrations that reuse planning context for implementation-stage model calls.","solutions":["Ensure the caller builds context via the implementation/basic-or-smart path so planningSharedMsgs is nil when the stage is implementation","Check the subtask/stage detection: if the plan should still be planning, fix why it is flagged as implementation","If using a custom context mode that yields shared planning messages, switch the plan/task to basic or smart context","Pass implementationMsgs alongside a nil planningSharedMsgs, or run with dryRunWithoutContext for token estimation"],"exampleFix":"// before\nsysPrompt, err := getTellSysPrompt(state, req, planningSharedMsgs, nil, false)\n// after\nvar planningMsgs []*types.ExtendedChatMessagePart // nil during implementation stage\nsysPrompt, err := getTellSysPrompt(state, req, planningMsgs, implementationMsgs, false)","handlingStrategy":"validation","validationCode":"if stage == \"implementation\" && planningSharedMsgs != nil {\n    planningSharedMsgs = nil // implementation stage only accepts basic/smart context\n}\nsysPrompt, err := getTellSysPrompt(state, req, planningSharedMsgs, implementationMsgs, dryRun)","typeGuard":"func planningContextAllowed(stage string, planningMsgs []*types.ExtendedChatMessagePart) bool {\n    return stage != \"implementation\" || planningMsgs == nil\n}","tryCatchPattern":"sysPrompt, err := getTellSysPrompt(state, req, planningSharedMsgs, implementationMsgs, dryRun)\nif err != nil && strings.Contains(err.Error(), \"planningSharedMsgs not supported\") {\n    sysPrompt, err = getTellSysPrompt(state, req, nil, implementationMsgs, dryRun)\n}","preventionTips":["Track plan stage explicitly and select the context-construction path from it","Never pass planningSharedMsgs together with implementation-stage subtasks","Use basic or smart context modes for implementation-stage calls","Add an assertion/test that implementation requests carry nil planning context"],"tags":["plandex","llm-prompt","context-mode","plan-stage"],"backgroundTag":"incompatible-context-mode","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}