diegosouzapw/OmniRoute · error

Video extraction broker returned an invalid response

Error message

Video extraction broker returned an invalid response

What it means

readBoundedResponse assembled the broker response body and JSON.parse failed, so the broker returned non-JSON (HTML error page, empty body, truncated stream, or proxy error) instead of a valid extraction result.

Solutions

  1. Log the first bytes of the raw text to identify what the broker actually returned
  2. Check that the Video Bridge broker service is running and healthy at resolveModelSyncInternalBaseUrl()
  3. Retry the extraction; if persistent, inspect broker logs for crashes or misrouting
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/lib/guardrails/videoBridgeBrokerClient.ts:55 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/3fe61062a20d20c9. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/guardrails/videoBridgeBrokerClient.ts:55

  samplingPolicy?: VideoSamplingPolicy;
  signal?: AbortSignal;
  timeoutMs: number;
}

const MAX_BROKER_RESPONSE_BYTES = 32 * 1024 * 1024;

export function resolveVideoBridgeBrokerBaseUrl(_candidate?: string): string {
  return resolveModelSyncInternalBaseUrl();
}

async function readBoundedResponse(response: Response, maxBytes: number): Promise<unknown> {
  const length = Number(response.headers.get("content-length"));
  if (Number.isFinite(length) && length > maxBytes) {
    await response.body?.cancel("Video extraction broker response exceeded its byte limit");
    throw new Error("Video extraction broker response exceeded its byte limit");
  }
  if (!response.body) {
    throw new Error("Video extraction broker returned an invalid response");
  }
  const reader = response.body.getReader();
  const chunks: Uint8Array[] = [];
  let totalBytes = 0;
  try {
    while (true) {
      const { done, value } = await reader.read();
      if (done) break;
      totalBytes += value.byteLength;
      if (totalBytes > maxBytes) {
        await reader.cancel("Video extraction broker response exceeded its byte limit");
        throw new Error("Video extraction broker response exceeded its byte limit");
      }
      chunks.push(value);
    }
  } finally {
    reader.releaseLock();
  }

View on GitHub (pinned to a179ffed5b)