{"record":{"id":"9cb701a40540958f","repo":"sgl-project/sglang","slug":"material-uri-has-an-invalid-base64-character-char","errorCode":null,"errorMessage":"material URI has an invalid base64 character {character!r}","messagePattern":"material URI has an invalid base64 character (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/material_io.py","lineNumber":143,"sourceCode":"        if character == \"%\":\n            if index + 2 >= len(uri):\n                raise ValueError(\"material URI has an invalid percent escape\")\n            try:\n                value = int(uri[index + 1 : index + 3], 16)\n            except ValueError as exc:\n                raise ValueError(\"material URI has an invalid percent escape\") from exc\n            index += 3\n            character = chr(value)\n        else:\n            index += 1\n\n        if character.isspace():\n            continue\n        if len(character) != 1 or ord(character) > 127:\n            raise ValueError(\"material URI base64 payload must be ASCII\")\n        value = ord(character)\n        if value not in _BASE64_ALPHABET:\n            raise ValueError(\n                f\"material URI has an invalid base64 character {character!r}\"\n            )\n        yield value\n\n\ndef _parse_tar_member_uri(uri: str) -> tuple[Path, int, int, str | None]:\n    if uri.startswith(\"tar+offset://\"):\n        prefix = \"tar+offset://\"\n    elif uri.startswith(\"tar+b64header://\"):\n        prefix = \"tar+b64header://\"\n    else:\n        raise ValueError(\"unsupported tar material URI\")\n    try:\n        tar_path, encoded_header = uri[len(prefix) :].rsplit(\":\", 1)\n    except ValueError as exc:\n        raise ValueError(\n            \"tar material URI must contain '<tar_path>:<encoded_header>'\"\n        ) from exc","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/material_io.py#L125-L161","documentation":"Every non-whitespace payload character of a base64 material URI must belong to the base64 alphabet (_BASE64_ALPHABET). Characters outside it (after percent-decoding) — e.g. '!', '@', 'é' — raise this error with the offending character shown.","triggerScenarios":"A payload containing characters outside A-Z, a-z, 0-9, '+', '/', '=', such as a URL-safe '-'/ '_' without urlsafe decoding, raw text, or punctuation.","commonSituations":"Mixing URL-safe base64 (with '-'/'_') into a standard-alphabet loader, embedding unencoded filenames or metadata in the payload, or corruption during transport.","solutions":["Re-encode the payload with standard base64 (base64.b64encode)","If the source is URL-safe base64, convert it: base64.urlsafe_b64decode then b64encode","Pre-validate with a regex ^[A-Za-z0-9+/=\\s]*$ before invoking the stage"],"exampleFix":"// before\nuri = \"base64://\" + urlsafe_b64  # contains '-' or '_'\n// after\nstd_b64 = base64.b64encode(base64.urlsafe_b64decode(urlsafe_b64 + '==')).decode('ascii')\nuri = \"base64://\" + std_b64","handlingStrategy":"validation","validationCode":"import re\nif not re.fullmatch(r'[A-Za-z0-9+/=\\s]*', payload):\n    raise ValueError('payload has non-base64 characters')","typeGuard":"def is_standard_base64(payload: str) -> bool:\n    import re\n    return re.fullmatch(r'[A-Za-z0-9+/=\\s]*', payload) is not None","tryCatchPattern":null,"preventionTips":["Convert URL-safe base64 to standard before embedding","Validate with a regex at ingestion"],"tags":["minimax-h3","base64","alphabet","material-io"],"backgroundTag":"invalid-base64-payload","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}