{"record":{"id":"c558df4bf7eab256","repo":"sgl-project/sglang","slug":"failed-to-load-config-from-config-path-str-e","errorCode":null,"errorMessage":"Failed to load config from {config_path}: {str(e)}","messagePattern":"Failed to load config from (.+?): (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/mem_cache/storage/hf3fs/storage_hf3fs.py","lineNumber":331,"sourceCode":"            return HiCacheHF3FS(\n                rank=rank,\n                file_path=f\"/data/hicache.{rank}.bin\",\n                file_size=1 << 40,\n                numjobs=16,\n                bytes_per_page=bytes_per_page,\n                entries=8,\n                client_timeout=5,\n                dtype=dtype,\n                metadata_client=Hf3fsLocalMetadataClient(),\n                is_page_first_layout=is_page_first_layout,\n                use_mock_client=use_mock_client,\n            )\n\n        try:\n            with open(config_path, \"r\") as f:\n                config = json.load(f)\n        except Exception as e:\n            raise RuntimeError(f\"Failed to load config from {config_path}: {str(e)}\")\n\n        # Check required keys (metadata_server_url is now optional)\n        required_keys = {\n            \"file_path_prefix\",\n            \"file_size\",\n            \"numjobs\",\n            \"entries\",\n        }\n        missing_keys = required_keys - set(config.keys())\n        if missing_keys:\n            raise ValueError(f\"Missing required keys in config: {missing_keys}\")\n\n        # Choose metadata client based on configuration\n        if config.get(\"metadata_server_url\"):\n            # Use global metadata client to connect to metadata server\n            metadata_server_url = config[\"metadata_server_url\"]\n            metadata_client = Hf3fsGlobalMetadataClient(metadata_server_url)\n","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/mem_cache/storage/hf3fs/storage_hf3fs.py#L313-L349","documentation":"from_env_config opens the JSON file named by the env var and json.load's it; any exception (file missing, permission denied, invalid JSON, BOM/encoding issue) is re-raised as RuntimeError with the path and original message.","triggerScenarios":"Setting the HF3FS config env var to a nonexistent path, a path with wrong permissions, or a file containing malformed JSON (trailing commas, comments, single quotes).","commonSituations":"Helm/K8s secret not mounted at the configured path; JSON hand-edited and broken; relative path resolved against a different working directory in a container.","solutions":["Validate the file exists and parses: python -c \"import json;json.load(open('/path/config.json'))\"","Use an absolute path for the env var value and verify mount/permissions in the container","Re-serde the JSON from a known-good template to eliminate syntax errors"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import json, os\n\npath = os.getenv(env_var)\nassert path and os.path.isfile(path), f'missing config file: {path}'\nconfig = json.load(open(path))  # raises here with a clear JSON error, not at from_env_config","typeGuard":null,"tryCatchPattern":"try:\n    backend = HiCacheHF3FS.from_env_config(rank=rank)\nexcept RuntimeError as e:\n    if 'Failed to load config' in str(e):\n        raise SystemExit(f'fix 3FS config file: {e}')\n    raise","preventionTips":["Validate the JSON with python -m json.tool in CI/deploy scripts","Use absolute paths and mount the config via a configmap/secret so it is always present"],"tags":["hf3fs","config-file","json-parse","invalid-path"],"backgroundTag":"config-file-parse-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}