stablyai/orca · warning
relay director resolve response too large
Error message
relay director resolve response too large
What it means
Thrown in resolveMobileRelayEndpoint when the response's declared content-length header exceeds MAX_RESPONSE_BYTES (16 KiB). The body is rejected before reading to prevent a memory blowup from a hostile or buggy director that honestly reports a huge length.
Source
Thrown at mobile/src/transport/mobile-relay-resume-director.ts:39
const timer = setTimeout(() => controller.abort(), args.timeoutMs ?? 5000)
try {
const url = new URL('/v1/resolve', args.relay.directorUrl)
const response = await (args.fetchImpl ?? fetch)(url.toString(), {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({
v: 1,
relayHostId: args.relay.relayHostId,
resumeToken: args.resumeToken
}),
signal: controller.signal
})
if (!response.ok) {
throw new Error(`relay director resolve failed (${response.status})`)
}
const declaredLength = Number(response.headers.get('content-length') ?? 0)
if (declaredLength > MAX_RESPONSE_BYTES) {
throw new Error('relay director resolve response too large')
}
const raw = await response.text()
if (new TextEncoder().encode(raw).byteLength > MAX_RESPONSE_BYTES) {
throw new Error('relay director resolve response too large')
}
const resolved = ResolveResponseSchema.parse(JSON.parse(raw) as unknown)
return {
...args.relay,
cellUrl: resolved.cellUrl,
assignmentEpoch: resolved.assignmentEpoch
}
} finally {
clearTimeout(timer)
}
}
function isCanonicalHttpsOrigin(value: string): boolean {
try {View on GitHub (pinned to 1136503c6a)
Solutions
- Verify relay.directorUrl points at the real relay director, not a generic server.
- Treat the trip as a protocol anomaly; do not raise MAX_RESPONSE_BYTES to work around it.
- Re-resolve from a known-good director URL.
Defensive patterns
Strategy: try-catch
Try / catch
try {
const endpoint = await resolveMobileRelayEndpoint(args)
} catch (error) {
if (error instanceof Error && error.message === 'relay director resolve response too large') {
// verify directorUrl points at the real director; do not raise the cap
}
} Prevention
- Confirm relay.directorUrl targets the real relay director, not a generic web server.
- Treat the size cap as a security boundary; never raise MAX_RESPONSE_BYTES to work around it.
- Probe the director with a known-good resume token in staging to confirm small responses.
When it happens
Trigger: The director returned a body whose declared content-length is over 16 KiB; a misconfigured/proxied endpoint streaming a large payload with an honest header.
Common situations: directorUrl pointing at a generic web server returning a large page; director bug concatenating responses; a proxy fronting the director with a large error payload.
Related errors
- relay director resolve failed (${response.status})
- GitHub API ${method} ${path} failed with ${response.status}:
- E2EE device authentication rejected
- ${response.error.code}: ${response.error.message}
- Azure DevOps request failed: HTTP ${response.status}
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/730b10b46838f3a3.
Report an issue: GitHub.