AlexxIT/go2rtc · error
err.Error()
Error message
err.Error()
What it means
Parsing the multipart request body failed in r.ParseMultipartForm(1024). This happens when the POST body is not valid multipart/form-data matching the Content-Type boundary, or the body exceeds the 1KB maxMemory buffer constraints in a malformed way; the raw parse error is relayed with HTTP 500.
Solutions
- Send the request as multipart/form-data with fields username and password
- Set the correct Content-Type header / form enctype
- Fall back to r.ParseForm for urlencoded requests
Example fix
// before
curl -X POST http://host/api -H 'Content-Type: application/json' -d '{"username":"u","password":"p"}'
// after
curl -X POST http://host/api -F 'username=u' -F 'password=p' Defensive patterns
Strategy: validation
Validate before calling
if !strings.HasPrefix(r.Header.Get("Content-Type"), "multipart/form-data") {
// return 415 asking for multipart/form-data before parsing
} Try / catch
if err := r.ParseMultipartForm(1024); err != nil {
// check content type first, then return 400 with a hint to use -F / multipart
} Prevention
- Send POST bodies as multipart/form-data (curl -F, form enctype)
- Verify the Content-Type header before posting
- Avoid proxies that truncate request bodies
- Read the handler's expected form format before integrating
When it happens
Trigger: POST to the roborock endpoint with a non-multipart Content-Type (e.g. application/x-www-form-urlencoded or JSON), a malformed boundary, or a truncated request body.
Common situations: Client sent JSON instead of multipart form data; curl default content type used; proxy truncated the body; forgot enctype='multipart/form-data' in an HTML form.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- milesone: authentication failed:
- failed to create request
- either email/password or refresh token is required
- no auth
- empty username or password
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/866e339bd367d300.
Report an issue: GitHub.
Appendix: source
Thrown at internal/roborock/roborock.go:36
api.HandleFunc("api/roborock", apiHandle)
}
var Auth struct {
UserData *roborock.UserInfo `json:"user_data"`
BaseURL string `json:"base_url"`
}
func apiHandle(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case "GET":
if Auth.UserData == nil {
http.Error(w, "no auth", http.StatusNotFound)
return
}
case "POST":
if err := r.ParseMultipartForm(1024); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
username := r.Form.Get("username")
password := r.Form.Get("password")
if username == "" || password == "" {
http.Error(w, "empty username or password", http.StatusBadRequest)
return
}
base, err := roborock.GetBaseURL(username)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
ui, err := roborock.Login(base, username, password)
if err != nil {View on GitHub (pinned to c245815e75)