{"record":{"id":"0c504ef6bc5e799f","repo":"sgl-project/sglang","slug":"file-normalized-input-does-not-exist","errorCode":null,"errorMessage":"File {normalized_input} does not exist.","messagePattern":"File (.+?) does not exist\\.","errorType":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/distributed/device_communicators/mooncake_transfer_engine.py","lineNumber":38,"sourceCode":"\n# Module-level shared engine instance, set by init_mooncake_transfer_engine().\n_mooncake_transfer_engine: Optional[MooncakeTransferEngine] = None\n\n\ndef parse_ib_device_config(\n    ib_device_str: Optional[str],\n) -> Optional[Union[str, Dict[int, str]]]:\n    \"\"\"Parse IB device config from a shared string, JSON mapping, or JSON file.\"\"\"\n    if ib_device_str is None or not ib_device_str.strip():\n        return None\n\n    normalized_input = ib_device_str.strip()\n    if not normalized_input.endswith(\".json\") and not normalized_input.startswith(\"{\"):\n        return normalized_input\n\n    if normalized_input.endswith(\".json\"):\n        if not os.path.isfile(normalized_input):\n            raise RuntimeError(f\"File {normalized_input} does not exist.\")\n        try:\n            with open(normalized_input, \"r\", encoding=\"utf-8\") as file:\n                mapping = json.load(file)\n        except json.JSONDecodeError as exc:\n            raise RuntimeError(\n                f\"Failed to parse JSON content from file {normalized_input}\"\n            ) from exc\n        except (IOError, OSError) as exc:\n            raise RuntimeError(\n                f\"Failed to read JSON file {normalized_input}: {exc}\"\n            ) from exc\n    else:\n        try:\n            mapping = json.loads(normalized_input)\n        except json.JSONDecodeError as exc:\n            raise ValueError(f\"Invalid JSON mapping: {normalized_input}\") from exc\n\n    if not isinstance(mapping, dict):","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/distributed/device_communicators/mooncake_transfer_engine.py#L20-L56","documentation":"While parsing the mooncake transfer engine's --mooncake-ip-device configuration, a string ending in .json was treated as a path to a GPU-id-to-IB-device mapping file, but os.path.isfile reported the file does not exist. The parse_ib_device_config helper raises before attempting to open it. Callers are get_ib_devices_for_gpu and _validate_ib_devices during MooncakeTransferEngine construction.","triggerScenarios":"Passing a *.json path via the mooncake IB-device config string (file or CLI arg) where the path is wrong, relative to a different working directory, or on a node where the file was not provisioned.","commonSituations":"Typos or stale paths in the config file argument, relative paths resolved from a different CWD in multi-node launches, or the JSON mapping file present on the head node but missing on worker nodes.","solutions":["Check the path exists on every node that constructs the transfer engine (ls <path> on that host)","Use an absolute path for the .json mapping file in launch scripts / cluster configs","If you meant to pass an inline mapping, remove the .json suffix and pass the JSON object string directly, or pass a plain comma-separated IB device string"],"exampleFix":"# before\n--mooncake-ip-device /wrong/path/gpu_ib_map.json\n\n# after\n--mooncake-ip-device /etc/sglang/gpu_ib_map.json  # absolute, present on all nodes","handlingStrategy":"validation","validationCode":"import os\n\ndef check_ib_config_path(cfg: str) -> None:\n    if cfg.strip().endswith(\".json\") and not os.path.isfile(cfg.strip()):\n        raise FileNotFoundError(f\"IB mapping file not found: {cfg}\"); resolve to absolute paths early","typeGuard":null,"tryCatchPattern":"try:\n    get_ib_devices_for_gpu(cfg, gpu_id)\nexcept (RuntimeError, ValueError) as e:\n    raise ConfigurationError(f\"bad mooncake IB config: {e}\") from e","preventionTips":["Use absolute paths for the .json mapping in cluster launch scripts","Provision the mapping file identically on every node (config management)","Fail fast at startup with a path existence check"],"tags":["config","mooncake","ib-devices","file-not-found"],"backgroundTag":"config-file-not-found","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}