{"record":{"id":"63738bfd5a02a18b","repo":"router-for-me/CLIProxyAPI","slug":"failed-to-encode-codex-live-call-request-w","errorCode":null,"errorMessage":"failed to encode Codex live call request: %w","messagePattern":"failed to encode Codex live call request: %w","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"internal/client/codex/live/live.go","lineNumber":733,"sourceCode":"\t\t\treturn nil, \"\", errEncode\n\t\t}\n\t\treturn encoded, \"application/json\", nil\n\t}\n\tif errMediaType != nil || !strings.EqualFold(mediaType, \"application/json\") {\n\t\treturn nil, \"\", errors.New(\"Codex live media relay requires an SDP or JSON call request\")\n\t}\n\tvar payload map[string]json.RawMessage\n\tif errUnmarshal := json.Unmarshal(body, &payload); errUnmarshal != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"failed to decode Codex live call request: %w\", errUnmarshal)\n\t}\n\tencodedSDP, errMarshal := json.Marshal(sdp)\n\tif errMarshal != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"failed to encode Codex live SDP offer: %w\", errMarshal)\n\t}\n\tpayload[\"sdp\"] = encodedSDP\n\tencoded, errMarshal := json.Marshal(payload)\n\tif errMarshal != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"failed to encode Codex live call request: %w\", errMarshal)\n\t}\n\treturn encoded, \"application/json\", nil\n}\n\nfunc callResponseSDP(body []byte, contentType string) (string, error) {\n\tmediaType, _, errMediaType := mime.ParseMediaType(contentType)\n\tif errMediaType == nil && strings.EqualFold(mediaType, \"application/json\") {\n\t\tvar payload struct {\n\t\t\tSDP string `json:\"sdp\"`\n\t\t}\n\t\tif errUnmarshal := json.Unmarshal(body, &payload); errUnmarshal != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to decode Codex live response: %w\", errUnmarshal)\n\t\t}\n\t\tif strings.TrimSpace(payload.SDP) == \"\" {\n\t\t\treturn \"\", errors.New(\"Codex live response requires an SDP answer\")\n\t\t}\n\t\treturn payload.SDP, nil\n\t}","sourceCodeStart":715,"sourceCodeEnd":751,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/client/codex/live/live.go#L715-L751","documentation":"Error \"failed to encode Codex live call request: %w\" thrown in router-for-me/CLIProxyAPI.","triggerScenarios":"Thrown at internal/client/codex/live/live.go:733 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the call request fields are serializable before encoding.","Check the wrapped encode error for details."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}