router-for-me/CLIProxyAPI · critical

Codex live response requires an SDP answer

Error message

Codex live response requires an SDP answer

What it means

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.

Source

Thrown at internal/client/codex/live/live.go:748

	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"`
	}
	if errUnmarshal := json.Unmarshal(body, &payload); errUnmarshal != nil {
		return ""

View on GitHub (pinned to 78f0c4079e)

Solutions

  1. Increase memory limits or unload unused plugins.
  2. Profile native (CGO) memory usage — Go heap metrics alone will not show C-side exhaustion.
  3. Isolate suspicious plugins to identify allocator corruption if memory is genuinely available.
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: Loading a plugin while the process is out of memory; native memory exhaustion from CGO-heavy workloads.

Common situations: Memory-capped containers; leaks in other native plugins consuming the C heap.

Related errors


AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15). Data as JSON: /api/errors/8ae3247ff22ddfe7. Report an issue: GitHub.