{"record":{"id":"463779bf9034e7eb","repo":"plandex-ai/plandex","slug":"name-cannot-be-empty","errorCode":null,"errorMessage":"Name cannot be empty","messagePattern":"Name cannot be empty","errorType":"http","errorClass":null,"httpStatus":400,"severity":"warning","filePath":"app/server/handlers/plans_crud.go","lineNumber":193,"sourceCode":"\t\treturn\n\t}\n\n\tvar requestBody shared.RenamePlanRequest\n\tif err := json.NewDecoder(r.Body).Decode(&requestBody); 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\tif plan.OwnerId != auth.User.Id {\n\t\tlog.Println(\"Only the plan owner can rename a plan\")\n\t\thttp.Error(w, \"Only the plan owner can rename a plan\", http.StatusForbidden)\n\t\treturn\n\t}\n\n\tif requestBody.Name == \"\" {\n\t\tlog.Println(\"Name cannot be empty\")\n\t\thttp.Error(w, \"Name cannot be empty\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\terr := db.RenamePlan(planId, requestBody.Name, nil)\n\n\tif err != nil {\n\t\tlog.Printf(\"Error renaming plan: %v\\n\", err)\n\t\thttp.Error(w, \"Error renaming plan: \"+err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tlog.Println(\"Successfully renamed plan\")\n}\n\nfunc DeletePlanHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"Received request for DeletePlanHandler\")\n\n\tauth := Authenticate(w, r, true)","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/handlers/plans_crud.go#L175-L211","documentation":"RenamePlanHandler returns this 400 when the decoded RenamePlanRequest has an empty Name field. The server requires a non-empty new name; it does not default or auto-generate one for renames. This is a straightforward input validation rejection.","triggerScenarios":"POST rename with body {\"name\":\"\"} or {} (Name zero-value); client code passing an empty string variable; a script where the name argument was not interpolated; whitespace-only names still pass this check (only empty string is rejected).","commonSituations":"CLI renaming with an unset shell variable (PLDX_NAME=\"\"); a UI form allowing submission before entering a name; serialized client object where the field was named \"title\" instead of \"name\" so it decodes as empty.","solutions":["Send a non-empty name in the JSON body: {\"name\":\"new-name\"}","Fix the client to validate the name is non-empty before issuing the rename request","Check shell/CI variable expansion so the name argument isn't dropped","Verify the client struct tag is json:\"name\" so the field actually decodes"],"exampleFix":"// before\nif requestBody.Name == \"\" { /* server 400 */ }\n// after (client-side guard)\nif strings.TrimSpace(newName) == \"\" { return errors.New(\"plan name cannot be empty\") }\n// then send {\"name\": newName}","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(newName) == \"\" { return errors.New(\"plan name is required\") }","typeGuard":"func isValidPlanName(s string) bool { return strings.TrimSpace(s) != \"\" }","tryCatchPattern":"if err := client.RenamePlan(planId, newName); err != nil {\n\tif strings.Contains(err.Error(), \"Name cannot be empty\") {\n\t\t// prompt user for a valid name and retry\n\t}\n}","preventionTips":["Validate the name field is non-empty (and trimmed) in the client before submitting","Guard against unset shell/environment variables supplying empty names in scripts","Ensure the JSON field tag is json:\"name\" so values actually decode","Never submit raw forms/CLI args without a required-field check"],"tags":["validation","bad-request","input","client-error"],"backgroundTag":"input-validation-failed","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"}