{"record":{"id":"8ae3247ff22ddfe7","repo":"router-for-me/CLIProxyAPI","slug":"codex-live-response-requires-an-sdp-answer","errorCode":null,"errorMessage":"Codex live response requires an SDP answer","messagePattern":"Codex live response requires an SDP answer","errorType":"http","errorClass":null,"httpStatus":502,"severity":"critical","filePath":"internal/client/codex/live/live.go","lineNumber":748,"sourceCode":"\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}\n\tif strings.TrimSpace(string(body)) == \"\" {\n\t\treturn \"\", errors.New(\"Codex live response requires an SDP answer\")\n\t}\n\treturn string(body), nil\n}\n\nfunc modelFromJSON(body []byte) string {\n\tvar payload struct {\n\t\tModel   string `json:\"model\"`\n\t\tSession struct {\n\t\t\tModel string `json:\"model\"`\n\t\t} `json:\"session\"`\n\t}\n\tif errUnmarshal := json.Unmarshal(body, &payload); errUnmarshal != nil {\n\t\treturn \"\"","sourceCodeStart":730,"sourceCodeEnd":766,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/client/codex/live/live.go#L730-L766","documentation":"C.malloc failed for the small host-context pointer block created alongside the host API struct. Same class as the host-api allocation failure: process out of memory or a corrupted C allocator. Partial allocations are freed and the library closed before returning.","triggerScenarios":"Loading a plugin while the process is out of memory; native memory exhaustion from CGO-heavy workloads.","commonSituations":"Memory-capped containers; leaks in other native plugins consuming the C heap.","solutions":["Increase memory limits or unload unused plugins.","Profile native (CGO) memory usage — Go heap metrics alone will not show C-side exhaustion.","Isolate suspicious plugins to identify allocator corruption if memory is genuinely available."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Account for CGO/native memory, not just Go heap, when sizing containers.","Unload unused plugins to release native resources.","Audit native plugins for allocator corruption if failures recur with free memory."],"tags":["pluginhost","native","memory","cgo"],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}