decolua/9router · error

Cursor AgentService endpoint is not configured

Error message

Cursor AgentService endpoint is not configured

What it means

Catch-all in the Kiro MITM handler: after mapping the model and calling the router, any exception (fetch failure, EventStream decode error, pipeTransformedEventStream failure) is returned as HTTP 500 JSON with type "mitm_error" and handler:"kiro". The log line `[Kiro MITM] Request processing failed: ...` carries the underlying cause.

Source

Thrown at open-sse/executors/cursor.js:484

        try { if (req && !req.destroyed) req.end(); } catch {}
      },
      close,
      async read() {
        if (chunkQueue.length) return { value: chunkQueue.shift(), done: false };
        if (ended) {
          if (streamError) throw streamError;
          return { value: undefined, done: true };
        }
        const result = await new Promise((resolve) => { waiting = resolve; });
        if (streamError) throw streamError;
        return result || { value: undefined, done: true };
      },
    };
  }

  async executeAgent({ model, body, stream, credentials, signal }) {
    const agentEndpoint = PROVIDER_OAUTH.cursor?.agentEndpoint;
    if (!agentEndpoint) throw new Error("Cursor AgentService endpoint is not configured");

    const url = `${agentEndpoint}${AGENT_RUN_PATH}`;
    const headers = this.buildHeaders(credentials);
    const requestController = new AbortController();
    if (signal?.addEventListener) {
      signal.addEventListener("abort", () => requestController.abort(signal.reason), { once: true });
    }

    let session;
    try {
      session = this.openAgentHttp2Stream(url, headers, requestController.signal);
      session.write(buildAgentRunFrame(body.messages || [], model));
    } catch (error) {
      throw new Error(`Cursor AgentService request failed: ${error.message}`);
    }

    let responseHeaders;
    try {

View on GitHub (pinned to 90b52e06ff)

Solutions

  1. Read `[Kiro MITM] Request processing failed: <msg>` in server logs to identify the real error.
  2. Confirm the 9Router gateway is running and the MITM proxy forwards to the right LOCAL_PORT.
  3. Check Kiro connection credentials/refresh state on the router (expired OAuth is a common cause).
  4. Inspect the payload for content the OpenAI→Kiro translator can't convert (unusual tool blocks/images) and simplify it.
  5. Retry after fixing; transient failures clear on their own.
Defensive patterns

Strategy: try-catch

Validate before calling

const gatewayUp = await fetch(`http://localhost:${LOCAL_PORT}/dashboard`).then(r => r.ok).catch(() => false);
const kiroAuth = connection.authType === 'oauth' && connection.refreshToken ? 'ok' : 'check-credentials';
if (!gatewayUp || kiroAuth !== 'ok') throw new Error('Fix gateway/credentials before Kiro MITM routing');

Try / catch

try {
  await sendViaKiroMitm(body);
} catch (e) {
  const msg = String(e.message);
  if (/unauthorized|expired|authentication/i.test(msg)) reauthorizeKiroConnection();
  else if (/ECONNREFUSED|fetch failed/.test(msg)) ensureGatewayRunning();
}

Prevention

When it happens

Trigger: Kiro IDE sends a chat request intercepted by the MITM proxy (path /generateAssistantResponse or x-amz-target on `/`), a model mapping exists, and the intercept flow throws — router unreachable, OpenAI→Kiro conversion error, or upstream EventStream error.

Common situations: Router down or on the wrong port; request body fails convertOpenAIToKiro translation (unsupported content shape); upstream Kiro service rejects credentials; network interruption while piping the transformed EventStream.

Related errors


AI-assisted analysis of decolua/9router@90b52e06ff (2026-08-30). Data as JSON: /api/errors/dc05f7f4a2b20c19. Report an issue: GitHub.