{"record":{"id":"4785a3ac7eb76d3d","repo":"sgl-project/sglang","slug":"config-file-path-not-set-please-set-envs-sglang","errorCode":null,"errorMessage":"Config file path not set. Please set {envs.SGLANG_HICACHE_MOONCAKE_CONFIG_PATH.name}","messagePattern":"Config file path not set\\. Please set (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/mem_cache/storage/mooncake_store/mooncake_store.py","lineNumber":113,"sourceCode":"    local_hostname: str\n    metadata_server: str\n    global_segment_size: int\n    protocol: str\n    device_name: str\n    master_server_address: str\n    master_metrics_port: int\n    check_server: bool\n    standalone_storage: bool\n    client_server_address: str\n    enable_ssd_offload: bool = False\n    ssd_offload_path: Optional[str] = None\n    tenant_id: str = DEFAULT_TENANT_ID\n\n    @staticmethod\n    def from_file() -> \"MooncakeStoreConfig\":\n        \"\"\"Load the config from a JSON file.\"\"\"\n        if not envs.SGLANG_HICACHE_MOONCAKE_CONFIG_PATH.is_set():\n            raise RuntimeError(\n                f\"Config file path not set. Please set {envs.SGLANG_HICACHE_MOONCAKE_CONFIG_PATH.name}\"\n            )\n        file_path = envs.SGLANG_HICACHE_MOONCAKE_CONFIG_PATH.get()\n        try:\n            with open(file_path) as fin:\n                config = json.load(fin)\n        except Exception as e:\n            raise RuntimeError(f\"Failed to load config from {file_path}: {str(e)}\")\n\n        if (\n            \"master_server_address\" not in config\n            and \"client_server_address\" not in config\n        ):\n            raise ValueError(\n                \"Either master_server_address or client_server_address is required in config file\"\n            )\n\n        return MooncakeStoreConfig(","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/mem_cache/storage/mooncake_store/mooncake_store.py#L95-L131","documentation":"MooncakeStoreConfig.from_file() was invoked but the SGLANG_HICACHE_MOONCAKE_CONFIG_PATH environment variable is unset, so there is no JSON config file to load. The error names the exact variable expected.","triggerScenarios":"Running with mooncake-backed HiCache where the loader path is 'file' but SGLANG_HICACHE_MOONCAKE_CONFIG_PATH was never exported, or exported in a different shell than the server.","commonSituations":"Kubernetes/docker env vars dropped; CI script forgot to export; users following mooncache docs that only set MOONCAKE_* vars.","solutions":["export SGLANG_HICACHE_MOONCAKE_CONFIG_PATH=/path/to/config.json and ensure the file exists","Or switch config source to env (MOONCAKE_MASTER/MOONCAKE_CLIENT) or extra_config so from_file is not used"],"exampleFix":"# before\npython -m sglang.launch_server --hicache-storage-backend mooncake\n# after\nexport SGLANG_HICACHE_MOONCAKE_CONFIG_PATH=/etc/sglang/mooncake.json\npython -m sglang.launch_server --hicache-storage-backend mooncake","handlingStrategy":"validation","validationCode":"from sglang.srt import environ as envs\nimport os\nif envs.SGLANG_HICACHE_MOONCAKE_CONFIG_PATH.is_set():\n    p = envs.SGLANG_HICACHE_MOONCAKE_CONFIG_PATH.get()\n    assert os.path.isfile(p), f'{p} missing'\nelse:\n    # fallback: env-based config requires MOONCAKE_MASTER/MOONCAKE_CLIENT\n    assert os.environ.get('MOONCAKE_MASTER') or os.environ.get('MOONCAKE_CLIENT')","typeGuard":null,"tryCatchPattern":"try:\n    cfg = MooncakeStoreConfig.from_file()\nexcept RuntimeError as e:\n    if 'Config file path not set' in str(e):\n        os.environ['SGLANG_HICACHE_MOONCAKE_CONFIG_PATH'] = '/etc/sglang/mooncake.json'\n        cfg = MooncakeStoreConfig.from_file()\n    else:\n        raise","preventionTips":["Set mooncake env vars in the deployment manifest (k8s env / docker -e)","Fail fast in launch scripts if config path unset"],"tags":["env-var","mooncake","config","missing-configuration"],"backgroundTag":"missing-env-var","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}