plandex-ai/plandex · error
Error reading request body
Error message
Error reading request body
What it means
ApplyPlanHandler could not read the raw request body via io.ReadAll(r.Body) and returns 500 'Error reading request body'. Unlike JSON parsing errors (which are 400), this means the byte stream itself failed — the connection broke or the body could not be delivered.
Source
Thrown at app/server/handlers/plans_changes.go:130
}
vars := mux.Vars(r)
planId := vars["planId"]
branch := vars["branch"]
log.Println("planId: ", planId, "branch: ", branch)
plan := authorizePlan(w, planId, auth)
if plan == nil {
return
}
var err error
// 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.ApplyPlanRequest
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
}
// Just in case this was sent immediately after a stream finished, wait a little before locking to allow for cleanup
time.Sleep(100 * time.Millisecond)
ctx, cancel := context.WithCancel(r.Context())
var settings *shared.PlanSettings
var currentPlanParams db.CurrentPlanStateParamsView on GitHub (pinned to e2d772072e)
Solutions
- Check client-side network stability and retry the apply
- Raise the reverse proxy body size limit (e.g. nginx client_max_body_size) if bodies are large
- Increase client HTTP timeout so the body finishes streaming
- Confirm no intermediary (LB, service mesh) is resetting the connection
Example fix
null
Defensive patterns
Strategy: retry
Validate before calling
null
Type guard
null
Try / catch
try {
const res = await fetch(applyUrl, {body: raw, signal: AbortSignal.timeout(60000)});
if (res.status === 500 && (await res.text()).includes('Error reading request body')) {
// connection dropped mid-upload — retry with backoff
}
} catch (e) { /* network error path */ } Prevention
- Use generous HTTP timeouts for apply requests
- Check reverse proxy body-size and timeout limits (e.g. nginx client_max_body_size)
- Retry idempotently-safe reads before apply on network errors
- Avoid applying over unstable connections/VPNs with large bodies
When it happens
Trigger: Client disconnects mid-upload; proxy/load balancer terminates the connection; request exceeds a body size limit and the server/transport resets the stream.
Common situations: Unstable network or VPN dropping large uploads; reverse proxy (nginx) closing the request due to client_max_body_size; client timeout set shorter than upload time.
Related errors
- Error reading request body
- Error reading request body
- Error reading request body:
- Error reading request body
- Error reading request body
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/f887d0c9c0bef8fb.
Report an issue: GitHub.