{"record":{"id":"bdfb6ecde064ca5a","repo":"sgl-project/sglang","slug":"minimax-h3-base64-decoded-size-total-expected","errorCode":null,"errorMessage":"MiniMax H3 base64 decoded size {total} != expected {decoded_size}","messagePattern":"MiniMax H3 base64 decoded size (.+?) != expected (.+?)","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":639,"sourceCode":"                if len(encoded_chunk) == MINIMAX_H3_BASE64_DECODE_CHUNK_CHARS:\n                    decoded_chunk = _decode_base64_chunk(encoded_chunk)\n                    total += len(decoded_chunk)\n                    output.write(decoded_chunk)\n                    encoded_chunk.clear()\n            if encoded_size == 0:\n                raise ValueError(\"material URI base64 payload is empty\")\n            if encoded_size % 4 == 1 or (padding and encoded_size % 4):\n                raise ValueError(\"material URI has an invalid base64 payload length\")\n            if encoded_chunk:\n                encoded_chunk.extend(b\"=\" * (-len(encoded_chunk) % 4))\n                decoded_chunk = _decode_base64_chunk(encoded_chunk)\n                total += len(decoded_chunk)\n                output.write(decoded_chunk)\n        decoded_size = (encoded_size * 3) // 4 - padding\n        if decoded_size <= 0:\n            raise ValueError(\"material URI decoded payload is empty\")\n        if total != decoded_size:\n            raise ValueError(\n                f\"MiniMax H3 base64 decoded size {total} != expected {decoded_size}\"\n            )\n        partial_path.replace(output_path)\n    except Exception:\n        partial_path.unlink(missing_ok=True)\n        output_path.unlink(missing_ok=True)\n        raise\n    return str(output_path)\n\n\ndef _stream_tar_member_material(\n    batch: Any,\n    uri: str,\n    *,\n    condition_type: str,\n    condition_index: int,\n) -> str:\n    source_path, offset, size, member = _parse_tar_member_uri(uri)","sourceCodeStart":621,"sourceCodeEnd":657,"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#L621-L657","documentation":"Internal consistency check: the total number of bytes produced by chunked decoding does not match the analytically computed expected decoded size. Indicates malformed base64 that decoded inconsistently, or a bug in the chunker.","triggerScenarios":"Malformed payload where per-chunk decode lengths sum to something other than (encoded_size*3)//4 - padding; should be unreachable for well-formed base64.","commonSituations":"Almost always a corrupted payload or a code change to _decode_base64_chunk / chunk constants; not typically a user config issue.","solutions":["Re-encode the asset with the standard library to guarantee canonical base64","If it persists with valid base64, report a bug with the payload length and chunk constants","Verify MINIMAX_H3_BASE64_DECODE_CHUNK_CHARS was not modified"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"except ValueError as e: log payload metadata and file a bug — should be unreachable for canonical base64","preventionTips":["Use only stdlib-generated base64"],"tags":["base64","internal-consistency","minimax-h3"],"backgroundTag":"invalid-base64-payload","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}