plandex-ai/plandex · warning

Name cannot be empty

Error message

Name cannot be empty

What it means

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.

Source

Thrown at app/server/handlers/plans_crud.go:193

		return
	}

	var requestBody shared.RenamePlanRequest
	if err := json.NewDecoder(r.Body).Decode(&requestBody); err != nil {
		log.Printf("Error parsing request body: %v\n", err)
		http.Error(w, "Error parsing request body", http.StatusBadRequest)
		return
	}

	if plan.OwnerId != auth.User.Id {
		log.Println("Only the plan owner can rename a plan")
		http.Error(w, "Only the plan owner can rename a plan", http.StatusForbidden)
		return
	}

	if requestBody.Name == "" {
		log.Println("Name cannot be empty")
		http.Error(w, "Name cannot be empty", http.StatusBadRequest)
		return
	}

	err := db.RenamePlan(planId, requestBody.Name, nil)

	if err != nil {
		log.Printf("Error renaming plan: %v\n", err)
		http.Error(w, "Error renaming plan: "+err.Error(), http.StatusInternalServerError)
		return
	}

	log.Println("Successfully renamed plan")
}

func DeletePlanHandler(w http.ResponseWriter, r *http.Request) {
	log.Println("Received request for DeletePlanHandler")

	auth := Authenticate(w, r, true)

View on GitHub (pinned to e2d772072e)

Solutions

  1. Send a non-empty name in the JSON body: {"name":"new-name"}
  2. Fix the client to validate the name is non-empty before issuing the rename request
  3. Check shell/CI variable expansion so the name argument isn't dropped
  4. Verify the client struct tag is json:"name" so the field actually decodes

Example fix

// before
if requestBody.Name == "" { /* server 400 */ }
// after (client-side guard)
if strings.TrimSpace(newName) == "" { return errors.New("plan name cannot be empty") }
// then send {"name": newName}
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(newName) == "" { return errors.New("plan name is required") }

Type guard

func isValidPlanName(s string) bool { return strings.TrimSpace(s) != "" }

Try / catch

if err := client.RenamePlan(planId, newName); err != nil {
	if strings.Contains(err.Error(), "Name cannot be empty") {
		// prompt user for a valid name and retry
	}
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/463779bf9034e7eb. Report an issue: GitHub.