{"record":{"id":"fb54cf280b088406","repo":"diegosouzapw/OmniRoute","slug":"stream-readiness-timeout","errorCode":"STREAM_READINESS_TIMEOUT","errorMessage":"${reason}","messagePattern":"\\$\\{reason\\}","errorType":"http","errorClass":null,"httpStatus":504,"severity":"error","filePath":"open-sse/utils/streamReadiness.ts","lineNumber":519,"sourceCode":"\n  const timeoutReason = () =>\n    `Stream produced no non-ping SSE event within ${effectiveTimeoutMs}ms`;\n\n  try {\n    while (true) {\n      const remainingMs = deadline - Date.now();\n      if (remainingMs <= 0) {\n        const reason = timeoutReason();\n        options.log?.warn?.(\n          \"STREAM\",\n          `${reason} (${options.provider || \"provider\"}/${options.model || \"unknown\"})`\n        );\n        await reader.cancel(reason).catch(() => {});\n        return {\n          ok: false,\n          reason,\n          classificationReason: reason,\n          code: \"STREAM_READINESS_TIMEOUT\",\n          type: \"stream_timeout\",\n          response: createErrorResponse(\n            HTTP_STATUS.GATEWAY_TIMEOUT,\n            reason,\n            \"STREAM_READINESS_TIMEOUT\",\n            \"stream_timeout\"\n          ),\n        };\n      }\n\n      let readResult: ReadableStreamReadResult<Uint8Array>;\n      try {\n        readResult = await readWithTimeout(reader, remainingMs);\n      } catch {\n        const reason = timeoutReason();\n        options.log?.warn?.(\n          \"STREAM\",\n          `${reason} (${options.provider || \"provider\"}/${options.model || \"unknown\"})`","sourceCodeStart":501,"sourceCodeEnd":537,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/open-sse/utils/streamReadiness.ts#L501-L537","documentation":"Stream readiness probe timed out (STREAM_READINESS_TIMEOUT): the upstream SSE produced no non-ping event within effectiveTimeoutMs, so the probe cancels the reader and reports failure with the timeout reason — the provider accepted the connection but never started streaming real content.","triggerScenarios":"Thrown at open-sse/utils/streamReadiness.ts:519 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the request; first-token stalls are often transient","Increase the readiness timeout for slow-thinking models","Check provider status — a hung upstream or stuck queue is likely"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}