{"record":{"id":"d45185b738e72934","repo":"plandex-ai/plandex","slug":"failed-to-build-plan-v","errorCode":null,"errorMessage":"failed to build plan: %v","messagePattern":"failed to build plan: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/context_load.go","lineNumber":737,"sourceCode":"\t}\n\n\tvar res *shared.LoadContextResponse\n\tif cachedMapLoadRes != nil {\n\t\tres = cachedMapLoadRes\n\t} else {\n\t\tres, apiErr = api.Client.LoadContext(CurrentPlanId, CurrentBranch, loadContextReq)\n\t\tif apiErr != nil {\n\t\t\tonErr(fmt.Errorf(\"failed to load context: %v\", apiErr.Msg))\n\t\t}\n\t}\n\n\tterm.StopSpinner()\n\n\tif hasConflicts {\n\t\tterm.StartSpinner(\"🏗️  Starting build...\")\n\t\t_, err := buildPlanInlineFn(false, nil)\n\t\tif err != nil {\n\t\t\tonErr(fmt.Errorf(\"failed to build plan: %v\", err))\n\t\t}\n\t\tfmt.Println()\n\t}\n\n\tfmt.Println(\"✅ \" + res.Msg)\n\n\tif len(alreadyLoadedByComposite) > 0 {\n\t\tprintAlreadyLoadedMsg(alreadyLoadedByComposite)\n\t}\n\n\tif len(ignoredPaths) > 0 && !params.SkipIgnoreWarning {\n\t\tprintIgnoredMsg()\n\t}\n\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)","sourceCodeStart":719,"sourceCodeEnd":755,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/context_load.go#L719-L755","documentation":"After loading context, if conflicts were detected MustLoadContext calls buildPlanInlineFn to start a build; any error from that build is wrapped with this message. It means the automatic build triggered by context conflicts failed. The user's context was loaded, but the conflict-resolution build did not start or errored.","triggerScenarios":"hasConflicts is true after load and buildPlanInlineFn(false, nil) returns an error — server build failure, invalid model/plan state, or API error during build creation.","commonSituations":"Conflicting context versions on the branch; plan in a state that cannot accept builds (archived, another build running); insufficient credits or plan limits reached.","solutions":["Read the wrapped %v to see why the build failed","Retry the build manually with the build/apply command once the plan state is settled","Resolve the conflicting context entries (unload duplicates/old versions) and rebuild"],"exampleFix":"// before\n_, err := buildPlanInlineFn(false, nil)\nif err != nil {\n    onErr(fmt.Errorf(\"failed to build plan: %v\", err))\n}\n// after — fall back to telling the user to build manually\n_, err := buildPlanInlineFn(false, nil)\nif err != nil {\n    fmt.Printf(\"⚠️  auto-build failed (%v); run the build command manually to resolve conflicts\\n\", err)\n}","handlingStrategy":"try-catch","validationCode":"if hasConflicts && planArchived {\n    return fmt.Errorf(\"cannot auto-build archived plan; resolve conflicts manually\")\n}","typeGuard":null,"tryCatchPattern":"_, err := buildPlanInlineFn(false, nil)\nif err != nil {\n    fmt.Printf(\"auto-build failed: %v — resolve conflicts and build manually\\n\", err)\n    // do not crash the whole load; context is already loaded\n}","preventionTips":["Avoid loading duplicate/conflicting versions of the same file","Ensure the plan is in an active state before context loads that trigger builds","Monitor build credits/limits if builds fail repeatedly"],"tags":["build","plan","context"],"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"}