decolua/9router · error
Machine ID is required for Cursor API
Error message
Machine ID is required for Cursor API
What it means
Generic catch-all inside the Antigravity MITM handler: when re-routing an intercepted request to the 9Router throws for any reason, the handler echoes the underlying error.message back to the IDE client. If the original request was streaming, it returns a synthetic SSE error chunk (HTTP 200) so the SDK does not hang; otherwise it returns HTTP 500 JSON with type "mitm_error".
Source
Thrown at open-sse/executors/cursor.js:292
});
}
export class CursorExecutor extends BaseExecutor {
constructor() {
super("cursor", PROVIDERS.cursor);
}
buildUrl() {
return `${this.config.baseUrl}${this.config.chatPath}`;
}
buildHeaders(credentials) {
const accessToken = credentials.accessToken;
const machineId = credentials.providerSpecificData?.machineId;
const ghostMode = credentials.providerSpecificData?.ghostMode !== false;
if (!machineId) {
throw new Error("Machine ID is required for Cursor API");
}
return buildCursorHeaders(accessToken, machineId, ghostMode);
}
transformRequest(model, body, stream, credentials) {
// Messages are already translated by chatCore (claude→openai→cursor)
// Do NOT call openaiToCursorRequest again — double-translation drops tool_results
const messages = body.messages || [];
const tools = body.tools || [];
const reasoningEffort = body.reasoning_effort || null;
// Detect Claude Code UA to force Agent mode (issue #643)
const ua = credentials?.rawHeaders?.["user-agent"] || "";
const forceAgentMode = ua.includes("claude-cli") || ua.includes("claude-code") || ua.includes("Claude Code");
return generateCursorBody(messages, model, tools, reasoningEffort, forceAgentMode);
}
async makeFetchRequest(url, headers, body, signal, proxyOptions = null) {View on GitHub (pinned to 90b52e06ff)
Solutions
- Verify the 9Router server (dashboard/gateway on the configured LOCAL_PORT) is running and reachable — the MITM handler forwards to it.
- Check the MITM proxy logs / dumper output for the underlying [ERROR] message to identify the real failure.
- Confirm the model used by the IDE has a valid entry in the antigravity model mapping (getMappedModel); unmapped models pass through instead.
- Retry the request; transient router/upstream failures surface as this 500.
- If it persists, bypass the MITM proxy for Antigravity traffic (remove proxy env) until the router issue is fixed.
Example fix
// before: client hangs or gets opaque 500
res.end(JSON.stringify({ error: { message: error.message, type: "mitm_error" } }));
// after: inspect root cause by logging full stack in the handler catch
err(`[antigravity] ${error.stack}`);
res.end(JSON.stringify({ error: { message: error.message, type: "mitm_error" } })); Defensive patterns
Strategy: try-catch
Validate before calling
// before relying on MITM routing, check the router is up
const health = await fetch(`http://localhost:${LOCAL_PORT}/dashboard`).catch(() => null);
if (!health || !health.ok) throw new Error('9Router gateway is not running; disable MITM proxy or start it'); Try / catch
try {
await sendThroughMitm(request);
} catch (e) {
if (String(e.message).includes('mitm_error') || /ECONNREFUSED|fetch failed/.test(e.message)) {
// router down — bypass proxy or restart 9Router, then retry once
} else throw e;
} Prevention
- Keep the 9Router gateway running whenever the system/browser proxy points at the MITM port.
- Monitor the gateway health endpoint (/_mitm_health on the MITM server) before sending traffic.
- Keep model mappings current so intercepted models always resolve.
- Check the dumper/log output when a 500 mitm_error appears — the inner message names the real cause.
When it happens
Trigger: The Antigravity IDE sends a chat/stream request through the MITM proxy, the host maps to the antigravity tool, a model mapping exists, and the call to handlers.antigravity.intercept throws (router fetch failure, body parse failure, upstream error propagation) before the handler completes.
Common situations: 9Router backend not running or crashing while the MITM proxy still intercepts traffic; invalid mapped model; network/DNS failure reaching the local router; exception thrown while reading the intercepted body.
Related errors
- http2 module not available
- ${this.provider} requires accountId in providerSpecificData
- [antigravity] ${error.message}
- [copilot] ${error.message}
- HTTP/2 is required for Cursor AgentService (endpoint is h2-o
AI-assisted analysis of decolua/9router@90b52e06ff (2026-08-30).
Data as JSON: /api/errors/d2e97c862c799137.
Report an issue: GitHub.