{"record":{"id":"f7148b3651d0f4eb","repo":"diegosouzapw/OmniRoute","slug":"not-found-f7148b","errorCode":"not_found","errorMessage":"API port only serves OpenAI-compatible routes.","messagePattern":"API port only serves OpenAI-compatible routes\\.","errorType":"http","errorClass":null,"httpStatus":404,"severity":"error","filePath":"src/lib/apiBridgeServer.ts","lineNumber":184,"sourceCode":"\ndeclare global {\n  var __omnirouteApiBridgeStarted: boolean | undefined;\n}\n\nexport function initApiBridgeServer(): void {\n  if (globalThis.__omnirouteApiBridgeStarted) return;\n\n  const { apiPort, dashboardPort } = getRuntimePorts();\n  if (apiPort === dashboardPort) return;\n\n  const host = process.env.API_HOST || \"127.0.0.1\";\n\n  const server = http.createServer((req, res) => {\n    const rawUrl = req.url || \"/\";\n    const pathname = rawUrl.split(\"?\")[0] || \"/\";\n\n    if (!isOpenAiCompatiblePath(pathname)) {\n      res.writeHead(404, { \"content-type\": \"application/json\" });\n      res.end(\n        JSON.stringify({\n          error: \"not_found\",\n          message: \"API port only serves OpenAI-compatible routes.\",\n        })\n      );\n      return;\n    }\n\n    proxyRequest(req, res, dashboardPort);\n  });\n  server.requestTimeout = API_BRIDGE_TIMEOUTS.serverRequestTimeoutMs;\n  server.headersTimeout = API_BRIDGE_TIMEOUTS.serverHeadersTimeoutMs;\n  server.keepAliveTimeout = API_BRIDGE_TIMEOUTS.serverKeepAliveTimeoutMs;\n  server.setTimeout(API_BRIDGE_TIMEOUTS.serverSocketTimeoutMs);\n  server.on(\"upgrade\", (req, socket, head) => {\n    const rawUrl = req.url || \"/\";\n    const pathname = rawUrl.split(\"?\")[0] || \"/\";","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/apiBridgeServer.ts#L166-L202","documentation":"Error \"API port only serves OpenAI-compatible routes.\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/apiBridgeServer.ts:184 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}