plandex-ai/plandex · warning

name field is required

Error message

name field is required

What it means

This is an input-validation error returned by the plandex server's CreateProjectHandler. The handler parses the request body into shared.CreateProjectRequest and, if the Name field is empty (missing or ""), it rejects the request with HTTP 400 before touching the database. It guards against creating projects with blank names.

Source

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

	// 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.CreateProjectRequest
	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.Name == "" {
		log.Println("Received empty name field")
		http.Error(w, "name field is required", http.StatusBadRequest)
		return
	}

	var projectId string
	err = db.WithTx(r.Context(), "create project", func(tx *sqlx.Tx) error {
		var err error

		projectId, err = db.CreateProject(auth.OrgId, requestBody.Name, tx)

		if err != nil {
			log.Printf("Error creating project: %v\n", err)
			return fmt.Errorf("error creating project: %v", err)
		}

		return nil
	})

	if err != nil {

View on GitHub (pinned to e2d772072e)

Solutions

  1. Add a non-empty "name" field to the JSON request body and resend the request.
  2. Check the client code path that builds shared.CreateProjectRequest to ensure Name is populated (e.g. from a --name flag or prompt).
  3. If testing with curl, send -d '{"name":"my project"}' with Content-Type: application/json.
  4. Trim/validate user input on the client before calling the endpoint so empty submissions are blocked locally.

Example fix

// before
curl -X POST /projects -d '{}'
// after
curl -X POST /projects -d '{"name":"my project"}'
Defensive patterns

Strategy: validation

Validate before calling

name := strings.TrimSpace(req.Name)
if name == "" {
	return errors.New("name field is required")
}

Type guard

func hasName(req shared.CreateProjectRequest) bool {
	return strings.TrimSpace(req.Name) != ""
}

Prevention

When it happens

Trigger: POST to the create-project endpoint with a JSON body where "name" is omitted, set to "", or set to null (Go decodes null into empty string). Auth must have succeeded already (Authenticate returned non-nil).

Common situations: CLI or client bug not setting Name before marshaling; sending {} as body; migrations or older client versions with a renamed field (e.g. sending "projectName" instead of "name"); manual curl testing with a minimal payload; string that is only whitespace is technically accepted here but empty string is not.

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/d17d54b8eb904b28. Report an issue: GitHub.