{"record":{"id":"26dcff46fa110daf","repo":"diegosouzapw/OmniRoute","slug":"vision-api-error-message","errorCode":null,"errorMessage":"Vision API error: ${message}","messagePattern":"Vision API error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/guardrails/visionBridgeHelpers.ts","lineNumber":516,"sourceCode":"    if (!chunk || typeof chunk !== \"object\") continue;\n\n    const unwrapped = unwrapVisionSummary(chunk) as Record<string, unknown>;\n\n    // Error-only SSE chunk (`data: {\"error\":{...}}` with no choices) — surface\n    // the upstream message instead of a generic \"empty or invalid response\".\n    if (unwrapped.error != null && !Array.isArray(unwrapped.choices)) {\n      const err = unwrapped.error;\n      let message = \"\";\n      if (typeof err === \"string\") {\n        message = err;\n      } else if (typeof err === \"object\" && !Array.isArray(err)) {\n        message = (err as { message?: unknown }).message\n          ? String((err as { message?: unknown }).message)\n          : JSON.stringify(err);\n      } else {\n        message = String(err);\n      }\n      throw new Error(`Vision API error: ${message}`);\n    }\n\n    const choice = (unwrapped.choices as Array<Record<string, unknown>> | undefined)?.[0];\n    if (choice) sawChoices = true;\n\n    const delta = choice?.delta as Record<string, unknown> | undefined;\n    if (typeof delta?.content === \"string\" && delta.content.length > 0) {\n      contentParts.push(delta.content);\n    }\n    if (typeof delta?.reasoning_content === \"string\" && delta.reasoning_content.length > 0) {\n      reasoningParts.push(delta.reasoning_content);\n    }\n    // opencode-routed gateways (e.g. mimo-v2.5-free) stream chain-of-thought in\n    // `delta.reasoning` instead of `reasoning_content` (#6623).\n    if (typeof delta?.reasoning === \"string\" && delta.reasoning.length > 0) {\n      reasoningParts.push(delta.reasoning);\n    }\n","sourceCodeStart":498,"sourceCodeEnd":534,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/guardrails/visionBridgeHelpers.ts#L498-L534","documentation":"Error \"Vision API error: ${message}\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/guardrails/visionBridgeHelpers.ts:516 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"}