plandex-ai/plandex · error
active plan not found for plan ID %s and branch %s
Error message
active plan not found for plan ID %s and branch %s
What it means
buildWholeFileFallback's first error return when GetActivePlan(planId, branch) is nil — the whole-file builder cannot proceed without the active plan context. The error is also passed to fileState.onBuildFileError.
Source
Thrown at app/server/model/plan/build_whole_file.go:34
"github.com/sashabaranov/go-openai"
)
func (fileState *activeBuildStreamFileState) buildWholeFileFallback(buildCtx context.Context, proposedContent string, desc string, comments string, sessionId string) (string, error) {
auth := fileState.auth
filePath := fileState.filePath
clients := fileState.clients
authVars := fileState.authVars
planId := fileState.plan.Id
branch := fileState.branch
originalFile := fileState.preBuildState
config := fileState.settings.GetModelPack().GetWholeFileBuilder()
activePlan := GetActivePlan(planId, branch)
if activePlan == nil {
log.Printf("Active plan not found for plan ID %s and branch %s\n", planId, branch)
fileState.onBuildFileError(fmt.Errorf("active plan not found for plan ID %s and branch %s", planId, branch))
return "", fmt.Errorf("active plan not found for plan ID %s and branch %s", planId, branch)
}
baseModelConfig := config.GetBaseModelConfig(authVars, fileState.settings, fileState.orgUserConfig)
originalFileWithLineNums := shared.AddLineNums(originalFile)
proposedContentWithLineNums := shared.AddLineNums(proposedContent)
sysPrompt, headNumTokens := prompts.GetWholeFilePrompt(filePath, originalFileWithLineNums, proposedContentWithLineNums, desc, comments)
messages := []types.ExtendedChatMessage{
{
Role: openai.ChatMessageRoleSystem,
Content: []types.ExtendedChatMessagePart{
{
Type: openai.ChatMessagePartTypeText,
Text: sysPrompt,
},View on GitHub (pinned to e2d772072e)
Solutions
- Activate/register the plan before calling the whole-file builder
- Log and verify planId and branch values at the call site
- Fix race conditions where plan cleanup runs before build fallback
Defensive patterns
Strategy: try-catch
Validate before calling
if GetActivePlan(planId, branch) == nil {
return fmt.Errorf("cannot run whole-file build: plan %s inactive on %s", planId, branch)
} Type guard
func hasActivePlan(planId, branch string) bool { return GetActivePlan(planId, branch) != nil } Try / catch
out, err := buildWholeFileFallback(...)
if err != nil && strings.Contains(err.Error(), "active plan not found") {
// recreate/activate plan and retry, or surface a user-facing plan-state error
} Prevention
- Check plan activation before invoking fallback builds
- Avoid concurrent plan removal during active builds
- Pass the correct (non-empty) branch identifier
When it happens
Trigger: Whole-file build invoked with a planId/branch pair that has no registered active plan.
Common situations: Branch mismatch (e.g. empty or renamed branch), plan finished/cleared before the fallback runs, or caller passing a stale planId.
Related errors
- active plan not found for plan ID %s and branch %s
- no current project
- no current plan
- active plan not found for plan ID %s and branch %s
- plan updates out of order: %s
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/0bf6534ebaa04d5b.
Report an issue: GitHub.