{"record":{"id":"dc05f7f4a2b20c19","repo":"decolua/9router","slug":"cursor-agentservice-endpoint-is-not-configured","errorCode":null,"errorMessage":"Cursor AgentService endpoint is not configured","messagePattern":"Cursor AgentService endpoint is not configured","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"open-sse/executors/cursor.js","lineNumber":484,"sourceCode":"        try { if (req && !req.destroyed) req.end(); } catch {}\n      },\n      close,\n      async read() {\n        if (chunkQueue.length) return { value: chunkQueue.shift(), done: false };\n        if (ended) {\n          if (streamError) throw streamError;\n          return { value: undefined, done: true };\n        }\n        const result = await new Promise((resolve) => { waiting = resolve; });\n        if (streamError) throw streamError;\n        return result || { value: undefined, done: true };\n      },\n    };\n  }\n\n  async executeAgent({ model, body, stream, credentials, signal }) {\n    const agentEndpoint = PROVIDER_OAUTH.cursor?.agentEndpoint;\n    if (!agentEndpoint) throw new Error(\"Cursor AgentService endpoint is not configured\");\n\n    const url = `${agentEndpoint}${AGENT_RUN_PATH}`;\n    const headers = this.buildHeaders(credentials);\n    const requestController = new AbortController();\n    if (signal?.addEventListener) {\n      signal.addEventListener(\"abort\", () => requestController.abort(signal.reason), { once: true });\n    }\n\n    let session;\n    try {\n      session = this.openAgentHttp2Stream(url, headers, requestController.signal);\n      session.write(buildAgentRunFrame(body.messages || [], model));\n    } catch (error) {\n      throw new Error(`Cursor AgentService request failed: ${error.message}`);\n    }\n\n    let responseHeaders;\n    try {","sourceCodeStart":466,"sourceCodeEnd":502,"githubUrl":"https://github.com/decolua/9router/blob/90b52e06ffd666b7929554211474d01588f6b1f8/open-sse/executors/cursor.js#L466-L502","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read `[Kiro MITM] Request processing failed: <msg>` in server logs to identify the real error.","Confirm the 9Router gateway is running and the MITM proxy forwards to the right LOCAL_PORT.","Check Kiro connection credentials/refresh state on the router (expired OAuth is a common cause).","Inspect the payload for content the OpenAI→Kiro translator can't convert (unusual tool blocks/images) and simplify it.","Retry after fixing; transient failures clear on their own."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const gatewayUp = await fetch(`http://localhost:${LOCAL_PORT}/dashboard`).then(r => r.ok).catch(() => false);\nconst kiroAuth = connection.authType === 'oauth' && connection.refreshToken ? 'ok' : 'check-credentials';\nif (!gatewayUp || kiroAuth !== 'ok') throw new Error('Fix gateway/credentials before Kiro MITM routing');","typeGuard":null,"tryCatchPattern":"try {\n  await sendViaKiroMitm(body);\n} catch (e) {\n  const msg = String(e.message);\n  if (/unauthorized|expired|authentication/i.test(msg)) reauthorizeKiroConnection();\n  else if (/ECONNREFUSED|fetch failed/.test(msg)) ensureGatewayRunning();\n}","preventionTips":["Keep the Kiro connection's OAuth tokens fresh in the dashboard.","Confirm gateway availability before routing Kiro traffic through the MITM.","Avoid payloads with content shapes the OpenAI→Kiro translator may not support (exotic tool blocks).","Grep `[Kiro MITM] Request processing failed` logs to catch systemic issues early."],"tags":["mitm","kiro","eventstream","router-forwarding"],"backgroundTag":"mitm-proxy-intercept-failure","analyzedSha":"90b52e06ffd666b7929554211474d01588f6b1f8","analyzedAt":"2026-08-30T21:05:45.952Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}