{"record":{"id":"8f8e8721cd920230","repo":"sgl-project/sglang","slug":"minimax-h3-adaln-cache-max-plans-must-be-positive","errorCode":null,"errorMessage":"MiniMax H3 AdaLN cache max_plans must be positive","messagePattern":"MiniMax H3 AdaLN cache max_plans must be positive","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/dits/minimax_h3.py","lineNumber":1151,"sourceCode":"\n    def __init__(\n        self,\n        arch: MiniMaxH3DiTArchConfig,\n        *,\n        path: str | None = None,\n        model_variant: str | None = None,\n        weight_files: list[str] | None = None,\n        max_plans: int = 64,\n        max_plan_width: int = MINIMAX_H3_ADALN_MAX_PLAN_WIDTH,\n    ) -> None:\n        super().__init__()\n        if (path is None) == (weight_files is None):\n            raise ValueError(\n                \"MiniMax H3 AdaLN cache takes exactly one of path (prebuilt \"\n                \"sidecar) or weight_files (rebuild from the checkpoint)\"\n            )\n        if max_plans < 1:\n            raise ValueError(\"MiniMax H3 AdaLN cache max_plans must be positive\")\n        if max_plan_width < 1:\n            raise ValueError(\n                \"MiniMax H3 AdaLN cache max_plan_width must be positive; \"\n                \"set --minimax-h3-adaln-plan-width to at least 1\"\n            )\n        self.path = path\n        self.model_variant = model_variant\n        self.weight_files = weight_files\n        self.max_plans = max_plans\n        self.max_plan_width = max_plan_width\n        self.num_layers = arch.num_layers\n        self.hidden_size = arch.hidden_size\n        self.block_width = 6 * MINIMAX_H3_ADALN_MODALITY_NUM * arch.hidden_size\n        self.final_width = 2 * arch.hidden_size\n        # Rebuild path only: plan bit pattern -> slot, tracked on the host.\n        self._slots: dict[tuple[int, ...], int] = {}\n        self.rebuilds = 0\n","sourceCodeStart":1133,"sourceCodeEnd":1169,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/dits/minimax_h3.py#L1133-L1169","documentation":"The AdaLN plan cache is sized by max_plans (how many distinct timestep plans it can hold); a value below 1 makes the cache useless, so it is rejected at construction. The default is 64.","triggerScenarios":"Constructing the cache with max_plans=0 or a negative value, usually from an explicit argument or a miscomputed config value.","commonSituations":"A CLI/config knob wired straight into max_plans with 0 meaning 'unlimited' in the user's mind, or an arithmetic expression that can underflow to 0.","solutions":["Pass max_plans >= 1 (keep default 64 unless tuning)","If 0 should mean unlimited in your tooling, translate it to a large positive value before construction"],"exampleFix":"# before\ncache = MinimaxH3AdaLNCache(weight_files=fs, max_plans=0)\n# after\ncache = MinimaxH3AdaLNCache(weight_files=fs, max_plans=64)","handlingStrategy":"validation","validationCode":"max_plans = max(1, int(max_plans))\n# or reject explicitly:\nif max_plans < 1: raise ValueError(\"max_plans must be >= 1\")","typeGuard":"def valid_max_plans(v: int) -> bool:\n    return isinstance(v, int) and v >= 1","tryCatchPattern":null,"preventionTips":["Clamp CLI-provided cache sizes to >= 1 at the args layer","Treat 0 as 'use default' rather than passing it through"],"tags":["minimax-h3","adaln-cache","argument-validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}