router-for-me/CLIProxyAPI · error
failed to decode Codex live response: %w
Error message
failed to decode Codex live response: %w
What it means
Error "failed to decode Codex live response: %w" thrown in router-for-me/CLIProxyAPI.
Source
Thrown at internal/client/codex/live/live.go:745
if errMarshal != nil {
return nil, "", fmt.Errorf("failed to encode Codex live SDP offer: %w", errMarshal)
}
payload["sdp"] = encodedSDP
encoded, errMarshal := json.Marshal(payload)
if errMarshal != nil {
return nil, "", fmt.Errorf("failed to encode Codex live call request: %w", errMarshal)
}
return encoded, "application/json", nil
}
func callResponseSDP(body []byte, contentType string) (string, error) {
mediaType, _, errMediaType := mime.ParseMediaType(contentType)
if errMediaType == nil && strings.EqualFold(mediaType, "application/json") {
var payload struct {
SDP string `json:"sdp"`
}
if errUnmarshal := json.Unmarshal(body, &payload); errUnmarshal != nil {
return "", fmt.Errorf("failed to decode Codex live response: %w", errUnmarshal)
}
if strings.TrimSpace(payload.SDP) == "" {
return "", errors.New("Codex live response requires an SDP answer")
}
return payload.SDP, nil
}
if strings.TrimSpace(string(body)) == "" {
return "", errors.New("Codex live response requires an SDP answer")
}
return string(body), nil
}
func modelFromJSON(body []byte) string {
var payload struct {
Model string `json:"model"`
Session struct {
Model string `json:"model"`
} `json:"session"`View on GitHub (pinned to 78f0c4079e)
Solutions
- Verify the upstream Codex live response is valid JSON.
- Inspect the wrapped decode error and the raw upstream body.
When it happens
Trigger: Thrown at internal/client/codex/live/live.go:745 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/56d407eaf2306099.
Report an issue: GitHub.