plandex-ai/plandex · error
Error reading request body:
Error message
Error reading request body:
What it means
CreateAccountHandler reads the raw request body with io.ReadAll; if that read fails (connection dropped mid-request, body stream error), it responds 500 with `Error reading request body: <detail>`. This happens before any JSON parsing, so the payload never reached unmarshalling.
Source
Thrown at app/server/handlers/accounts.go:35
"github.com/jmoiron/sqlx"
)
func CreateAccountHandler(w http.ResponseWriter, r *http.Request) {
log.Println("Received request for CreateAccountHandler")
if os.Getenv("IS_CLOUD") != "" {
log.Println("Creating accounts is not supported in cloud mode")
http.Error(w, "Creating accounts is not supported in cloud mode", http.StatusNotImplemented)
return
}
isLocalMode := (os.Getenv("GOENV") == "development" && os.Getenv("LOCAL_MODE") == "1")
// 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.CreateAccountRequest
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
}
req.Email = strings.ToLower(req.Email)
var emailVerificationId string
// skipping email verification in dev/local mode
if !isLocalMode {
emailVerificationId, err = db.ValidateEmailVerification(req.Email, req.Pin)
View on GitHub (pinned to e2d772072e)
Solutions
- Retry the request from the client once the connection is stable
- Verify the HTTP client sends Content-Length / chunked encoding correctly and does not abort early
- Check proxy/load-balancer body size and timeout limits
- Inspect the server log line `Error reading request body: %v` for the underlying cause
Example fix
// before resp, err := http.Post(url, "application/json", brokenBodyReader) // after body, _ := json.Marshal(req) resp, err := http.Post(url, "application/json", bytes.NewReader(body))
Defensive patterns
Strategy: retry
Try / catch
resp, err := http.Post(url, "application/json", bytes.NewReader(payload))
if err != nil {
// transport-level failure: retry with backoff
resp, err = http.Post(url, "application/json", bytes.NewReader(payload))
} Prevention
- Send the body from an in-memory reader, not a live stream that can abort
- Set client timeouts longer than upload duration
- Avoid proxies with small body limits for large payloads
When it happens
Trigger: POSTing to the create-account endpoint with a broken/aborted connection, an oversized body that fails streaming, or a client that closes the connection before the body is fully transmitted.
Common situations: Flaky networks or proxies terminating long requests; HTTP clients with aggressive timeouts that abort while sending the body; load balancers with small body-size limits.
Related errors
- Error reading request body
- Error reading request body
- Error reading request body
- Error reading request body:
- Error parsing request body
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/f69f2a4210a8a0f0.
Report an issue: GitHub.