{"record":{"id":"0b4b713b5a5dd1c1","repo":"plandex-ai/plandex","slug":"failed-to-build-plan-v-0b4b71","errorCode":null,"errorMessage":"failed to build plan: %v","messagePattern":"failed to build plan: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/context_update.go","lineNumber":1013,"sourceCode":"\t\t}\n\t\tnewTotal := totalTokens + tokensDiff\n\t\toutdatedRes.Msg = shared.SummaryForUpdateContext(shared.SummaryForUpdateContextParams{\n\t\t\tNumFiles:    numFiles,\n\t\t\tNumTrees:    numTrees,\n\t\t\tNumUrls:     numUrls,\n\t\t\tNumMaps:     numMaps,\n\t\t\tTokensDiff:  tokensDiff,\n\t\t\tTotalTokens: newTotal,\n\t\t})\n\t}\n\n\tif hasConflicts {\n\t\tterm.StartSpinner(\"🏗️  Starting build...\")\n\t\t_, err := buildPlanInlineFn(false, nil)\n\t\tterm.StopSpinner()\n\t\tfmt.Println()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to build plan: %v\", err)\n\t\t}\n\t}\n\n\t// Warn about any items skipped\n\tif len(filesSkippedTooLarge) > 0 || len(filesSkippedAfterSizeLimit) > 0 ||\n\t\tlen(mapFilesTruncatedTooLarge) > 0 || len(mapFilesSkippedAfterSizeLimit) > 0 {\n\t\tprintSkippedFilesMsg(filesSkippedTooLarge, filesSkippedAfterSizeLimit,\n\t\t\tmapFilesTruncatedTooLarge, mapFilesSkippedAfterSizeLimit)\n\t}\n\n\treturn &outdatedRes, nil\n}\n\nfunc tableForContextOutdated(updatedContexts []*shared.Context, tokenDiffsById map[string]int) string {\n\tif len(updatedContexts) == 0 {\n\t\treturn \"\"\n\t}\n","sourceCodeStart":995,"sourceCodeEnd":1031,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/context_update.go#L995-L1031","documentation":"After a context update produced conflicts, the CLI starts an inline plan build via buildPlanInlineFn and wraps any build failure as 'failed to build plan: %v'. It surfaces that the regeneration of the plan (after conflict resolution) did not complete.","triggerScenarios":"hasConflicts is true after UpdateContext and the subsequent buildPlanInlineFn(false, nil) call returns an error — e.g. compile/analysis failure while rebuilding the plan from the merged context.","commonSituations":"Merge conflicts in updated context were auto-resolved but the resulting plan cannot build; source changes since last build broke the plan; LLM/codegen failure during inline rebuild; interrupted spinner session leaving partial state.","solutions":["Read the wrapped build error for the actual build failure","Fix the conflicting/outdated files flagged in the context update, then rebuild","Run the plan build manually to see full build output","Reset the plan context to a known-good state and re-apply updates"],"exampleFix":"// before: silent failure inside larger flow\nif err != nil {\n    return nil, fmt.Errorf(\"failed to build plan: %v\", err)\n}\n// after: guide user to rebuild\nif err != nil {\n    return nil, fmt.Errorf(\"failed to build plan: %v — resolve conflicts and run the build again\", err)\n}","handlingStrategy":"try-catch","validationCode":"if !hasConflicts {\n    return nil // no build needed\n}","typeGuard":null,"tryCatchPattern":"res, err := CheckOutdatedContext(...)\nif err != nil && strings.Contains(err.Error(), \"failed to build plan\") {\n    fmt.Fprintf(os.Stderr, \"plan rebuild failed, resolve conflicts and rebuild manually: %v\\n\", err)\n    return nil\n}","preventionTips":["Resolve all reported conflicts before triggering the rebuild","Run the build manually after large context updates to see full output","Keep local sources in a buildable state before refreshing plan context"],"tags":["cli","build","conflicts","plan"],"backgroundTag":"plan-build-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}