usestrix/strix · error · RelayError

too_large

too_large

Error message

too_large

What it means

RelayError('too_large') raised by report_send() when POST /api/oss/report/send returns 413. The PDF is base64-encoded into the JSON payload (pdf_base64), which inflates it ~33%; when the resulting body exceeds the relay's maximum request size, the relay rejects it with 413.

Source

Thrown at strix/interface/viewer/auth.py:245

    """Forward the encrypted PDF to the relay for delivery.

    The report password is NEVER part of this payload; only the encrypted PDF
    bytes travel to the relay.
    """
    payload = {
        "token": token,
        "pdf_base64": base64.b64encode(pdf_bytes).decode("ascii"),
        "filename": filename,
        "run_name": run_name,
        "target": target,
    }
    status, _ = _post_json("/api/oss/report/send", payload, timeout=_SEND_TIMEOUT)
    if status == 200:
        return
    if status == 401:
        raise RelayError("reverify")
    if status == 413:
        raise RelayError("too_large")
    if status == 403:
        raise RelayError("forbidden")
    raise RelayError("unavailable")


__all__ = [
    "AUTH_PATH",
    "RelayError",
    "feedback_submit",
    "forget",
    "is_verified",
    "otp_start",
    "otp_verify",
    "read_auth",
    "report_send",
    "write_auth",
]

View on GitHub (pinned to 8551339130)

Solutions

  1. Reduce PDF size before sending: strip embedded images/screenshots, compress images, or export a summary-only report
  2. Check size before sending: if base64.b64encode(pdf) would exceed the documented cap, warn the user and offer local download instead
  3. Split very large results into multiple runs/reports each under the limit
  4. If the cap is genuinely too low for legitimate use, report it upstream as a relay configuration issue

Example fix

# before
report_send(token, pdf_bytes, 'report.pdf', run, target)
# after
import base64
MAX_B64 = 9_500_000
if len(base64.b64encode(pdf_bytes)) > MAX_B64:
    save_locally(pdf_bytes)  # fallback path
else:
    report_send(token, pdf_bytes, 'report.pdf', run, target)
Defensive patterns

Strategy: fallback

Validate before calling

import base64

MAX_B64 = 9_500_000  # keep under the relay's request cap

def sendable(pdf: bytes) -> bool:
    return len(base64.b64encode(pdf)) <= MAX_B64

Try / catch

try:
    report_send(token, pdf, filename, run, target)
except RelayError as e:
    if e.code == "too_large":
        save_pdf_locally(pdf, filename)  # user still gets the report
    else:
        raise

Prevention

When it happens

Trigger: Calling report_send() with a PDF large enough that base64(pdf_bytes) plus metadata exceeds the relay's body cap. A relay limit of, say, 10 MB translates to roughly 7.5 MB of raw PDF before encoding overhead.

Common situations: Deep-scan reports with hundreds of findings and embedded screenshots; reports accumulated over long multi-target runs; users appending raw HTTP traces or full SARIF dumps to the PDF; slow growth of report size across releases until one day crossing the cap.

Related errors


AI-assisted analysis of usestrix/strix@8551339130 (2026-08-15). Data as JSON: /api/errors/01dc9e56de59ce5f. Report an issue: GitHub.