{"record":{"id":"01dc9e56de59ce5f","repo":"usestrix/strix","slug":"too-large","errorCode":"too_large","errorMessage":"too_large","messagePattern":"too_large","errorType":"error_code","errorClass":"RelayError","httpStatus":413,"severity":"error","filePath":"strix/interface/viewer/auth.py","lineNumber":245,"sourceCode":"    \"\"\"Forward the encrypted PDF to the relay for delivery.\n\n    The report password is NEVER part of this payload; only the encrypted PDF\n    bytes travel to the relay.\n    \"\"\"\n    payload = {\n        \"token\": token,\n        \"pdf_base64\": base64.b64encode(pdf_bytes).decode(\"ascii\"),\n        \"filename\": filename,\n        \"run_name\": run_name,\n        \"target\": target,\n    }\n    status, _ = _post_json(\"/api/oss/report/send\", payload, timeout=_SEND_TIMEOUT)\n    if status == 200:\n        return\n    if status == 401:\n        raise RelayError(\"reverify\")\n    if status == 413:\n        raise RelayError(\"too_large\")\n    if status == 403:\n        raise RelayError(\"forbidden\")\n    raise RelayError(\"unavailable\")\n\n\n__all__ = [\n    \"AUTH_PATH\",\n    \"RelayError\",\n    \"feedback_submit\",\n    \"forget\",\n    \"is_verified\",\n    \"otp_start\",\n    \"otp_verify\",\n    \"read_auth\",\n    \"report_send\",\n    \"write_auth\",\n]\n","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/usestrix/strix/blob/85513391305171ecc6faffe03da4a8bda5e3febb/strix/interface/viewer/auth.py#L227-L263","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Reduce PDF size before sending: strip embedded images/screenshots, compress images, or export a summary-only report","Check size before sending: if base64.b64encode(pdf) would exceed the documented cap, warn the user and offer local download instead","Split very large results into multiple runs/reports each under the limit","If the cap is genuinely too low for legitimate use, report it upstream as a relay configuration issue"],"exampleFix":"# before\nreport_send(token, pdf_bytes, 'report.pdf', run, target)\n# after\nimport base64\nMAX_B64 = 9_500_000\nif len(base64.b64encode(pdf_bytes)) > MAX_B64:\n    save_locally(pdf_bytes)  # fallback path\nelse:\n    report_send(token, pdf_bytes, 'report.pdf', run, target)","handlingStrategy":"fallback","validationCode":"import base64\n\nMAX_B64 = 9_500_000  # keep under the relay's request cap\n\ndef sendable(pdf: bytes) -> bool:\n    return len(base64.b64encode(pdf)) <= MAX_B64","typeGuard":null,"tryCatchPattern":"try:\n    report_send(token, pdf, filename, run, target)\nexcept RelayError as e:\n    if e.code == \"too_large\":\n        save_pdf_locally(pdf, filename)  # user still gets the report\n    else:\n        raise","preventionTips":["Check base64-encoded size before sending; fall back to local export","Generate leaner reports (fewer embedded screenshots) for delivery","Split oversized multi-target results into separate runs"],"tags":["strix","relay","viewer","report-delivery","payload-size"],"backgroundTag":null,"analyzedSha":"85513391305171ecc6faffe03da4a8bda5e3febb","analyzedAt":"2026-08-15T05:03:57.275Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}