{"record":{"id":"43db13e195123c49","repo":"router-for-me/CLIProxyAPI","slug":"failed-to-decode-realtime-call-request-w","errorCode":null,"errorMessage":"failed to decode Realtime call request: %w","messagePattern":"failed to decode Realtime call request: %w","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"internal/client/codex/live/live.go","lineNumber":565,"sourceCode":"\nfunc applyClientSecretCallSession(body []byte, contentType, model string, session json.RawMessage) ([]byte, string, string, error) {\n\tif len(session) == 0 {\n\t\treturn body, contentType, model, nil\n\t}\n\tmediaType, _, errMediaType := mime.ParseMediaType(contentType)\n\tif errMediaType == nil && (strings.EqualFold(mediaType, \"application/sdp\") || strings.EqualFold(mediaType, \"text/plain\")) {\n\t\tencoded, errEncode := encodeCallRequest(string(body), session)\n\t\tif errEncode != nil {\n\t\t\treturn nil, \"\", \"\", errEncode\n\t\t}\n\t\treturn encoded, \"application/json\", modelFromJSON(session), nil\n\t}\n\tif errMediaType != nil || !strings.EqualFold(mediaType, \"application/json\") {\n\t\treturn nil, \"\", \"\", errors.New(\"Realtime client secrets require 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 Realtime call request: %w\", errUnmarshal)\n\t}\n\tpayload[\"session\"] = append(json.RawMessage(nil), session...)\n\tencoded, errMarshal := json.Marshal(payload)\n\tif errMarshal != nil {\n\t\treturn nil, \"\", \"\", fmt.Errorf(\"failed to encode Realtime call request: %w\", errMarshal)\n\t}\n\treturn encoded, \"application/json\", modelFromJSON(session), nil\n}\n\nfunc rewriteCallRequestModel(body []byte, contentType, model string) ([]byte, string, error) {\n\tupstreamModel := codexRealtimeModel(model)\n\tmediaType, _, errMediaType := mime.ParseMediaType(contentType)\n\tif errMediaType != nil || !strings.EqualFold(mediaType, \"application/json\") || len(bytes.TrimSpace(body)) == 0 {\n\t\treturn body, upstreamModel, nil\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 Realtime call request: %w\", errUnmarshal)","sourceCodeStart":547,"sourceCodeEnd":583,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/client/codex/live/live.go#L547-L583","documentation":"Error \"failed to decode Realtime call request: %w\" thrown in router-for-me/CLIProxyAPI.","triggerScenarios":"Thrown at internal/client/codex/live/live.go:565 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send a valid JSON Realtime call request body.","Fix the JSON syntax error reported by the wrapped decode error."],"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"}