{"record":{"id":"5e645cbdd2a55133","repo":"sgl-project/sglang","slug":"pr-pr-num-revert-is-not-registered-available","errorCode":null,"errorMessage":"PR #{pr_num} revert is not registered; available: {sorted(_PR_FIX_REVERT_YAML.keys())}","messagePattern":"PR #(.+?) revert is not registered; available: (.+?)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/debug_utils/pr_fix_toggle.py","lineNumber":125,"sourceCode":"\n_PR_FIX_REVERT_YAML: Dict[int, str] = {\n    25015: _PR_REVERT_YAML_25015,\n    26329: _PR_REVERT_YAML_26329,\n    27338: _PR_REVERT_YAML_27338,\n    27360: _PR_REVERT_YAML_27360,\n    26972: _PR_REVERT_YAML_26972,\n    27460: _PR_REVERT_YAML_27460,\n}\n\n\ndef maybe_revert_pr_fix() -> None:\n    if pr_num := envs.SGLANG_DEBUG_REVERT_PR.get():\n        _revert_pr_fix(pr_num)\n\n\ndef _revert_pr_fix(pr_num: int) -> None:\n    if pr_num not in _PR_FIX_REVERT_YAML:\n        raise NotImplementedError(\n            f\"PR #{pr_num} revert is not registered; \"\n            f\"available: {sorted(_PR_FIX_REVERT_YAML.keys())}\"\n        )\n    apply_patches_from_config(_PR_FIX_REVERT_YAML[pr_num])\n","sourceCodeStart":107,"sourceCodeEnd":130,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/debug_utils/pr_fix_toggle.py#L107-L130","documentation":"Raised by _revert_pr_fix when SGLANG_DEBUG_REVERT_PR names a PR number that has no entry in the _PR_FIX_REVERT_YAML registry. The revert mechanism is a curated table of PR numbers mapped to patch YAML files; only registered PRs can be reverted. The error message lists the currently available PR numbers to guide the user.","triggerScenarios":"Setting SGLANG_DEBUG_REVERT_PR=<n> where <n> is not a key in _PR_FIX_REVERT_YAML, then triggering maybe_revert_pr_fix() (usually at debug-session startup).","commonSituations":"Typos in the env var value; trying to revert a PR that predates the revert-registry feature or whose patch file was never added; version skew where the registry keys changed between sglang versions.","solutions":["Pick a PR number from the list printed in the error message (sorted keys of _PR_FIX_REVERT_YAML)","Check the value of SGLANG_DEBUG_REVERT_PR for typos or stray characters","If you need an unlisted PR reverted, add a corresponding YAML entry to _PR_FIX_REVERT_YAML or unset the env var"],"exampleFix":"# before\nexport SGLANG_DEBUG_REVERT_PR=12345  # not registered\n\n# after\n# choose from the available list in the error message, e.g.\nexport SGLANG_DEBUG_REVERT_PR=4200","handlingStrategy":"validation","validationCode":"import os\nfrom sglang.srt.debug_utils.pr_fix_toggle import _PR_FIX_REVERT_YAML\npr = os.environ.get('SGLANG_DEBUG_REVERT_PR')\nif pr is not None and int(pr) not in _PR_FIX_REVERT_YAML:\n    raise ConfigError(f'{pr} not in {sorted(_PR_FIX_REVERT_YAML)}')","typeGuard":null,"tryCatchPattern":"try:\n    maybe_revert_pr_fix()\nexcept NotImplementedError as e:\n    log.warning('revert not registered: %s', e)\n    os.environ.pop('SGLANG_DEBUG_REVERT_PR', None)","preventionTips":["Cross-check the env var value against the registry keys at startup","Treat the error message's available list as the source of truth","Unset the env var in production to avoid accidental reverts"],"tags":["env-var","configuration","debug-utils","sglang"],"backgroundTag":"registry-key-not-found","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}