router-for-me/CLIProxyAPI · error
failed to parse Codex live multipart body: %w
Error message
failed to parse Codex live multipart body: %w
What it means
Error "failed to parse Codex live multipart body: %w" thrown in router-for-me/CLIProxyAPI.
Source
Thrown at internal/client/codex/live/live.go:635
return encoded, upstreamModel, nil
}
func multipartCallRequest(body []byte, boundary string) ([]byte, string, string, error) {
if boundary == "" {
return nil, "", "", errors.New("Codex live multipart boundary is missing")
}
reader := multipart.NewReader(bytes.NewReader(body), boundary)
var sdp *string
var session json.RawMessage
model := ""
for {
part, errPart := reader.NextPart()
if errors.Is(errPart, io.EOF) {
break
}
if errPart != nil {
return nil, "", "", fmt.Errorf("failed to parse Codex live multipart body: %w", errPart)
}
partBody, errRead := io.ReadAll(part)
errClose := part.Close()
if errRead != nil {
return nil, "", "", fmt.Errorf("failed to read Codex live multipart field: %w", errRead)
}
if errClose != nil {
return nil, "", "", fmt.Errorf("failed to close Codex live multipart field: %w", errClose)
}
switch part.FormName() {
case "sdp":
value := string(partBody)
sdp = &value
case "session":
if !json.Valid(partBody) {
return nil, "", "", errors.New("Codex live session field must contain valid JSON")
}View on GitHub (pinned to 78f0c4079e)
Solutions
- Send a well-formed multipart body with a valid boundary header.
- Verify the Content-Type header includes the correct boundary parameter.
When it happens
Trigger: Thrown at internal/client/codex/live/live.go:635 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15).
Data as JSON: /api/errors/5a196cb88feae493.
Report an issue: GitHub.