plandex-ai/plandex · error
Error reading request body
Error message
Error reading request body
What it means
CreatePlanHandler returns this 500 when io.ReadAll(r.Body) fails while reading the raw request body. This means the body stream errored mid-read — the client disconnected, the body was truncated, or a proxy/transport error interrupted the upload. Note the response deliberately omits the underlying error detail.
Source
Thrown at app/server/handlers/plans_crud.go:55
projectId := vars["projectId"]
log.Println("projectId: ", projectId)
if !authorizeProject(w, projectId, auth) {
return
}
_, apiErr := hooks.ExecHook(hooks.WillCreatePlan, hooks.HookParams{Auth: auth})
if apiErr != nil {
writeApiError(w, *apiErr)
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", http.StatusInternalServerError)
return
}
defer r.Body.Close()
var requestBody shared.CreatePlanRequest
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
}
name := requestBody.Name
if name == "" {
name = "draft"
}
if name == "draft" {
// delete any existing draft plansView on GitHub (pinned to e2d772072e)
Solutions
- Retry the request from a stable connection
- Check server/client network path and reverse proxy body-size or timeout settings
- Verify the client actually sends a body and does not abort mid-write
- Increase client HTTP timeout for slow links
- Check server logs for connection-reset patterns at the same time
Example fix
// before
curl -X POST $URL/plans --max-time 1 -d name=myplan
// after
curl -X POST $URL/plans --max-time 30 -H 'Content-Type: application/json' -d '{"name":"myplan"}' Defensive patterns
Strategy: validation
Validate before calling
const body = JSON.stringify({name});
if (!navigator.onLine) throw new Error('No network connection');
const res = await fetch(url, {method:'POST', body, headers:{'Content-Type':'application/json'}, signal: AbortSignal.timeout(30000)}); Try / catch
try {
await createPlan(projectId, name);
} catch (e) {
if (/Error reading request body/.test(e.message)) {
// connection dropped mid-upload — retry once on a fresh connection
return createPlan(projectId, name);
}
throw e;
} Prevention
- Set adequate client HTTP timeouts for slow networks
- Keep create-plan request bodies small (name only)
- Check proxy/load-balancer idle and body timeouts
- Detect client aborts and retry idempotent creation attempts
When it happens
Trigger: POST create-plan where the TCP connection drops during body transfer, the client aborts the request mid-upload, a reverse proxy cuts off the body, or Content-Length/malformed chunked encoding truncates the stream.
Common situations: Client timeouts on slow networks while sending a large body; flaky proxies/load balancers terminating connections; curl/fetch calls aborted by the caller; HTTP client sending chunked bodies through a misconfigured proxy.
Related errors
- Error reading request body
- Error reading request body
- Error reading request body
- failed to save the downloaded archive: %w
- Error reading request body:
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/7e3be38ecb59f276.
Report an issue: GitHub.