plandex-ai/plandex · error
Error unmarshalling request:
Error message
Error unmarshalling request:
What it means
HTTP 500 error returned by CreateOrgHandler when json.Unmarshal fails to parse the request body into a shared.CreateOrgRequest. The body has already been read successfully, so this fires purely on malformed or structurally invalid JSON (wrong field types, truncated payload, or non-object input). Note the handler reports it as an internal error rather than a 400.
Source
Thrown at app/server/handlers/orgs.go:84
auth := Authenticate(w, r, false)
if auth == nil {
return
}
// 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: "+err.Error(), http.StatusInternalServerError)
return
}
var req shared.CreateOrgRequest
err = json.Unmarshal(body, &req)
if err != nil {
log.Printf("Error unmarshalling request: %v\n", err)
http.Error(w, "Error unmarshalling request: "+err.Error(), http.StatusInternalServerError)
return
}
var apiErr *shared.ApiError
var org *db.Org
err = db.WithTx(r.Context(), "create org", func(tx *sqlx.Tx) error {
var err error
var domain *string
if req.AutoAddDomainUsers {
if shared.IsEmailServiceDomain(auth.User.Domain) {
log.Printf("Invalid domain: %v\n", auth.User.Domain)
return fmt.Errorf("invalid domain: %v", auth.User.Domain)
}
domain = &auth.User.Domain
}
// create a new orgView on GitHub (pinned to e2d772072e)
Solutions
- Log/inspect the raw body to find the JSON defect
- Ensure the client sends valid CreateOrgRequest JSON with correct types
- Return 400 instead of 500 for malformed client input
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at app/server/handlers/orgs.go:84 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/0b02a916fdfa7695.
Report an issue: GitHub.