vitessio/vitess · error
cannot parse form: %s
Error message
cannot parse form: %s
What it means
The /livequeryz handler calls r.ParseForm() and returns HTTP 500 'cannot parse form: <err>' when the request's form data is malformed and cannot be parsed. This guards the format=json query handling that follows.
Source
Thrown at go/vt/vttablet/tabletserver/livequeryz.go:68
<td>{{.Duration}}</td>
<td>{{.Start}}</td>
<td>{{.ConnID}}</td>
<td><a href='terminate?connID={{.ConnID}}'>Terminate</a></td>
</tr>
`))
)
func livequeryzHandler(queryLists []*QueryList, w http.ResponseWriter, r *http.Request) {
if err := acl.CheckAccessHTTP(r, acl.DEBUGGING); err != nil {
acl.SendError(w, err)
return
}
var rows []QueryDetailzRow
for _, ql := range queryLists {
rows = ql.AppendQueryzRows(rows)
}
if err := r.ParseForm(); err != nil {
http.Error(w, fmt.Sprintf("cannot parse form: %s", err), http.StatusInternalServerError)
return
}
format := r.FormValue("format")
if format == "json" {
js, err := json.Marshal(rows)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
w.Header().Set("Content-Type", "application/json")
w.Write(js)
return
}
logz.StartHTMLTable(w)
defer logz.EndHTMLTable(w)
w.Write(livequeryzHeader)
for i := range rows {
if err := livequeryzTmpl.Execute(w, rows[i]); err != nil {View on GitHub (pinned to 01a25a7d17)
Solutions
- URL-encode query parameters correctly: /livequeryz?format=json
- Fix the proxy/client generating the malformed request
- Retry with a simple well-formed request to confirm the endpoint itself is healthy
Example fix
// before (unencoded) curl 'http://tablet:15100/livequeryz?format=json%' // after curl 'http://tablet:15100/livequeryz?format=json'
Defensive patterns
Strategy: validation
Validate before calling
u, err := url.Parse(baseURL + "/livequeryz")
if err != nil {
return err
}
u.RawQuery = "format=json" // let net/url encode properly Try / catch
resp, err := http.Get(u.String())
if resp != nil && resp.StatusCode == http.StatusInternalServerError {
body, _ := io.ReadAll(resp.Body)
if strings.Contains(string(body), "cannot parse form") {
// fix request encoding and retry
}
} Prevention
- Build URLs with net/url and url.Values instead of string concatenation
- Avoid manual percent-encoding in query strings
- Inspect proxy logs for request rewriting
When it happens
Trigger: GET/POST to /livequeryz with a malformed query string or body (bad percent-encoding, invalid URL syntax) causing http.Request.ParseForm to fail.
Common situations: Proxies or clients double-encoding query strings; truncated requests; hand-rolled URLs with unescaped special characters like & or %.
Related errors
- Method not allowed
- Missing varname or value
- err.Error() (invalid variable set value)
- err.Error() (JSON marshal failure)
- invalid connID
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/6dccb119e36c8594.
Report an issue: GitHub.