chenhg5/cc-connect · error

%s: %s

Error message

%s: %s

What it means

rpcRequestOverIO matched the JSON-RPC response to its request id, but the response carried a non-null `error` field; the server-side error message is returned prefixed with the RPC method name. This is an application-level error reported by the codex app-server itself for the requested method.

Source

Thrown at agent/codex/session.go:756

		var probe map[string]json.RawMessage
		if err := json.Unmarshal(bytes.TrimSpace(line), &probe); err != nil {
			continue
		}
		if _, ok := probe["id"]; !ok {
			continue
		}

		var resp rpcResponseEnvelope
		if err := json.Unmarshal(bytes.TrimSpace(line), &resp); err != nil {
			continue
		}
		respID, ok := rpcIDToInt64(resp.ID)
		if !ok || respID != id {
			continue
		}
		if resp.Error != nil {
			return fmt.Errorf("%s: %s", method, strings.TrimSpace(resp.Error.Message))
		}
		if out != nil {
			if err := json.Unmarshal(resp.Result, out); err != nil {
				return fmt.Errorf("%s decode response: %w", method, err)
			}
		}
		return nil
	}
}

func rpcNotifyOverIO(stdin io.Writer, method string, params any) error {
	payload := map[string]any{
		"jsonrpc": "2.0",
		"method":  method,
		"params":  params,
	}
	return writeRPCMessage(stdin, payload)
}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Read the embedded message after the method prefix — it states exactly why the server rejected the call.
  2. Update the Codex CLI so the app-server supports the RPC methods/params the connector sends.
  3. Re-authenticate (`codex login`) if the message indicates missing or expired credentials.
  4. Retry later for rate-limit/quota-style messages.
  5. Check the app-server's stderr logs for the full error context around the failing method.
Defensive patterns

Strategy: fallback

Validate before calling

// check version compatibility before RPC
codecVersion := queryCodexVersion(cfg.Command) // `codex --version`
if semver.Compare(codecVersion, minSupported) < 0 {
    return fmt.Errorf("codex %s too old for app-server RPC; need >= %s", codecVersion, minSupported)
}

Try / catch

err := rpcRequestOverIO(stdin, stdout, ctx, "initialize", params, &out)
if err != nil && isMethodLevelError(err) {
    // message after the method prefix explains the server-side rejection
    slog.Warn("app-server rejected method", "detail", err)
    // fallback: use defaults instead of runtime config
}

Prevention

When it happens

Trigger: A JSON-RPC response with matching id contains resp.Error != nil; the trimmed Error.Message is surfaced as `"<method>: <message>"` to the caller (loadCodexRuntimeConfig).

Common situations: Calling an RPC method unsupported by the installed codex version (method-not-found style errors); the app-server rejects the initialize params (bad protocol version, malformed capabilities); auth/quota errors returned over RPC.

Related errors


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/7442dbfed79e8f0d. Report an issue: GitHub.