calesthio/OpenMontage · error · ValueError

decoded Data URI must be smaller than MB

Error message

decoded {label} Data URI must be smaller than {max_bytes // (1024 * 1024)} MB

What it means

Error "decoded {label} Data URI must be smaller than {max_bytes // (1024 * 1024)} MB" thrown in calesthio/OpenMontage.

Solutions

  1. Reduce the decoded image size below the stated MB limit by resizing or recompressing before encoding.
  2. Alternatively host the image at a URL and pass the URL instead of a Data URI.

When it happens

Trigger: The decoded bytes of a reference Data URI exceed the maximum allowed size in megabytes.

Common situations: See trigger scenarios.


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/c3cf6fc558f6e166. Report an issue: GitHub.

Appendix: source

Thrown at tools/video/seedance_ark.py:1120

        match = re.fullmatch(
            r"data:([a-z]+/[a-z0-9.+-]+);base64,([A-Za-z0-9+/=]+)",
            value,
            flags=re.IGNORECASE,
        )
        if not match:
            raise ValueError(
                f"{label} Data URI must use a supported MIME type and "
                "strict base64 encoding"
            )
        mime = match.group(1).lower()
        if mime not in set(suffix_to_mime.values()):
            raise ValueError(f"unsupported {label} Data URI MIME type: {mime}")
        try:
            decoded = base64.b64decode(match.group(2), validate=True)
        except (ValueError, binascii.Error) as exc:
            raise ValueError(f"invalid base64 in {label} Data URI") from exc
        if len(decoded) >= max_bytes:
            raise ValueError(
                f"decoded {label} Data URI must be smaller than "
                f"{max_bytes // (1024 * 1024)} MB"
            )
        return mime, decoded

    def _local_or_data_audio_duration(
        self, value: str, *, max_seconds: int = 15
    ) -> float | None:
        if value.startswith("data:"):
            mime, decoded = self._decode_data_uri(
                value,
                suffix_to_mime=self.AUDIO_SUFFIX_TO_MIME,
                max_bytes=self.MAX_AUDIO_BYTES,
                label="audio",
            )
            return self._probe_audio_bytes(decoded, mime, max_seconds=max_seconds)
        if self._is_remote_or_asset(value):
            return None

View on GitHub (pinned to 95e1c3d0ab)