odysseus-dev/odysseus · error · HTTPException

Signature PNG is too large

Error message

Signature PNG is too large

What it means

Error "Signature PNG is too large" thrown in odysseus-dev/odysseus.

Source

Thrown at routes/signature_routes.py:42

_DATA_URL_RE = re.compile(r"^data:image/png;base64,(?P<data>.+)$", re.IGNORECASE | re.DOTALL)
_ANY_IMAGE_DATA_URL_RE = re.compile(r"^data:image/[^;]+;base64,", re.IGNORECASE)
_PNG_MAGIC = b"\x89PNG\r\n\x1a\n"
_MAX_SIGNATURE_BYTES = 2 * 1024 * 1024
_MAX_SIGNATURE_B64 = ((_MAX_SIGNATURE_BYTES + 2) // 3) * 4
_MAX_SIGNATURE_DIMENSION = 4096


def _normalize_signature_png(raw: str) -> str:
    raw = (raw or "").strip()
    m = _DATA_URL_RE.match(raw)
    if m:
        b64 = m.group("data")
    elif _ANY_IMAGE_DATA_URL_RE.match(raw):
        raise HTTPException(400, "Signature data must be a PNG image")
    else:
        b64 = raw
    if len(b64) > _MAX_SIGNATURE_B64:
        raise HTTPException(400, "Signature PNG is too large")
    try:
        payload = base64.b64decode(b64, validate=True)
    except Exception:
        raise HTTPException(400, "Signature data must be base64-encoded PNG bytes")
    if not payload:
        raise HTTPException(400, "Signature PNG is empty")
    if len(payload) > _MAX_SIGNATURE_BYTES:
        raise HTTPException(400, "Signature PNG is too large")
    if not payload.startswith(_PNG_MAGIC):
        raise HTTPException(400, "Signature data must be a PNG image")
    return base64.b64encode(payload).decode("ascii")


def _signature_dimension(value: Optional[int]) -> Optional[int]:
    if value is None:
        return None
    if not isinstance(value, int) or value < 1 or value > _MAX_SIGNATURE_DIMENSION:
        raise HTTPException(400, "Signature dimensions are invalid")

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. Reduce the signature image size (dimensions/quality) and retry.
  2. Crop the signature tighter to shrink the PNG.

When it happens

Trigger: Triggered when the corresponding server-side validation or runtime check at the recorded location rejects the request or operation and returns this error message to the caller.

Common situations: See trigger scenarios.


AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14). Data as JSON: /api/errors/940fe7df90a296ee. Report an issue: GitHub.