JuliusBrussee/caveman · error

native runtime: invalid response

Error message

native runtime: invalid response

What it means

The native runtime Call decoded a response from the runtime socket, but the payload exceeded maxRequestBytes or failed response validation (schema/shape check). The response is untrusted IPC input, so oversized or malformed frames are rejected rather than parsed.

Source

Thrown at proxy/internal/nativeruntime/server_common.go:33

func Call(ctx context.Context, home string, request Request) (*Response, error) {
	callCtx, cancel := context.WithTimeout(ctx, hookDeadline)
	defer cancel()
	conn, err := dialNativeRuntime(callCtx, home)
	if err != nil {
		return nil, err
	}
	defer conn.Close()
	_ = conn.SetDeadline(time.Now().Add(hookDeadline))
	if err := json.NewEncoder(conn).Encode(request); err != nil {
		return nil, err
	}
	limited := &io.LimitedReader{R: conn, N: maxRequestBytes + 1}
	var response Response
	if err := json.NewDecoder(limited).Decode(&response); err != nil {
		return nil, err
	}
	if limited.N <= 0 || !validResponse(response) {
		return nil, errors.New("native runtime: invalid response")
	}
	return &response, nil
}

func validResponse(response Response) bool {
	if response.ProtocolVersion != ProtocolVersion || !response.FailOpen {
		return false
	}
	if response.PolicyMode != "" && response.PolicyMode != "record" && response.PolicyMode != "safe" && response.PolicyMode != "max" {
		return false
	}
	if response.Profile != "" {
		switch response.Profile {
		case "record-only", "core", "core-lean-build", "ledger", "ccr-masking", "cache-aware", "full-safe", "full-max":
		default:
			return false
		}
	}

View on GitHub (pinned to 766dce6b13)

Solutions

  1. Reduce the runtime response size (trim payloads, paginate results) below the IPC limit
  2. Verify the runtime version produces the expected response schema
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at proxy/internal/nativeruntime/server_common.go:33 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18). Data as JSON: /api/errors/6e7e36242070cb51. Report an issue: GitHub.