plandex-ai/plandex · warning

planId field is required

Error message

planId field is required

What it means

This is a field-validation error: the parsed SetProjectPlanRequest has an empty PlanId, so the handler rejects the request with HTTP 400 'planId field is required' before applying the update. Like error 1040, it enforces that the required plan identifier is present.

Source

Thrown at app/server/handlers/projects.go:157

	// read the request body
	body, err := io.ReadAll(r.Body)
	if err != nil {
		log.Printf("Error reading request body: %v\n", err)
		http.Error(w, "Error reading request body", http.StatusInternalServerError)
		return
	}
	defer r.Body.Close()

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

	if requestBody.PlanId == "" {
		log.Println("Received empty planId field")
		http.Error(w, "planId field is required", http.StatusBadRequest)
		return
	}

	// update statement here -- need auth / current user id

	log.Println("Successfully set project plan", projectId)
}

func RenameProjectHandler(w http.ResponseWriter, r *http.Request) {
	log.Println("Received request for RenameProjectHandler")
	auth := Authenticate(w, r, true)
	if auth == nil {
		return
	}

	vars := mux.Vars(r)
	projectId := vars["projectId"]

View on GitHub (pinned to e2d772072e)

Solutions

  1. Include a non-empty "planId" string in the JSON body: {"planId":"<plan-id>"}.
  2. Fix the client to obtain a real plan id (create or look up the plan) before calling this endpoint.
  3. Guard on the client: skip/queue the call when the plan id is empty instead of sending an empty one.
  4. If testing, use a plan id from a prior create-plan response.

Example fix

// before
{"planId": ""}
// after
{"planId": "01f3d0e9-8a2c-4b7e-9d1a-2c3b4d5e6f7a"}
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(planId) == "" {
	return errors.New("planId field is required")
}

Type guard

func hasPlanId(req shared.SetProjectPlanRequest) bool {
	return strings.TrimSpace(req.PlanId) != ""
}

Prevention

When it happens

Trigger: POST to the project set-plan endpoint with valid JSON but no "planId" key, "planId": "", or "planId": null (decodes to empty string).

Common situations: Client never resolved/selected a plan before calling set-plan; renamed field in client code (plan vs planId); stubbed client sending a placeholder empty payload; older client versions predating the planId field.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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