{"record":{"id":"d7a72173030d9901","repo":"plandex-ai/plandex","slug":"no-plans-found","errorCode":null,"errorMessage":"No plans found","messagePattern":"No plans found","errorType":"http","errorClass":null,"httpStatus":404,"severity":"warning","filePath":"app/server/handlers/plans_crud.go","lineNumber":609,"sourceCode":"\n\tvar req shared.GetCurrentBranchByPlanIdRequest\n\tif err := json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\tlog.Printf(\"Error parsing request body: %v\\n\", err)\n\t\thttp.Error(w, \"Error parsing request body\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tplans, err := db.ListOwnedPlans([]string{projectId}, auth.User.Id, false)\n\n\tif err != nil {\n\t\tlog.Printf(\"Error listing plans: %v\\n\", err)\n\t\thttp.Error(w, \"Error listing plans: \"+err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif len(plans) == 0 {\n\t\tlog.Println(\"No plans found\")\n\t\thttp.Error(w, \"No plans found\", http.StatusNotFound)\n\t\treturn\n\t}\n\n\tquery := \"SELECT * FROM branches WHERE \"\n\n\tvar orConditions []string\n\tvar queryArgs []interface{}\n\tcurrentArg := 1\n\tfor _, plan := range plans {\n\t\tbranchName, ok := req.CurrentBranchByPlanId[plan.Id]\n\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\torConditions = append(orConditions, fmt.Sprintf(\"(plan_id = $%d AND name = $%d)\", currentArg, currentArg+1))\n\t\tqueryArgs = append(queryArgs, plan.Id, branchName)\n","sourceCodeStart":591,"sourceCodeEnd":627,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/handlers/plans_crud.go#L591-L627","documentation":"A 404 returned by GetCurrentBranchByPlanIdHandler when ListOwnedPlans succeeds but returns zero plans for the given projectId and authenticated user. The endpoint only works for projects that contain at least one plan owned by the caller.","triggerScenarios":"Calling the current-branch endpoint with a projectId that has no plans, using an API token belonging to a different user/organization than the project owner, or after all plans in the project were deleted.","commonSituations":"Copy-pasting a projectId from another account; plans deleted or archived elsewhere; stale CLI config pointing at the wrong server/org; freshly created project with no plans yet.","solutions":["Confirm the projectId is correct and belongs to the authenticated user's org","List plans in the project first (plandex plans / list plans endpoint) to verify any exist","Check you are authenticated as the plan owner (ListOwnedPlans filters by user id)","Recreate a plan in the project if it was deleted"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const plans = await listPlans(projectId);\nif (!plans || plans.length === 0) {\n  throw new Error(`No plans in project ${projectId}; skipping current-branch lookup`);\n}","typeGuard":"function hasPlans(result) {\n  return Array.isArray(result) && result.length > 0;\n}","tryCatchPattern":"try {\n  const res = await api.getCurrentBranchByPlanId(projectId, body);\n} catch (err) {\n  if (err.status === 404 && err.message === 'No plans found') {\n    console.warn(`Project ${projectId} has no plans for this user; create one first`);\n    return null;\n  }\n  throw err;\n}","preventionTips":["List plans for the project before calling this endpoint","Verify the projectId matches the account you authenticated with","Remember ListOwnedPlans filters to the calling user — ownership matters","Handle 404 as a normal 'empty project' state, not a crash"],"tags":["http-404","not-found","plans","plandex-server"],"backgroundTag":"resource-not-found","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"}