{"record":{"id":"3334631a4db3ad11","repo":"sgl-project/sglang","slug":"please-install-mooncake-by-following-the-instructi-333463","errorCode":null,"errorMessage":"Please install mooncake by following the instructions at https://kvcache-ai.github.io/Mooncake/getting_started/build.html to run SGLang with MooncakeConnector.","messagePattern":"Please install mooncake by following the instructions at https://kvcache-ai\\.github\\.io/Mooncake/getting_started/build\\.html to run SGLang with MooncakeConnector\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/mem_cache/storage/mooncake_store/mooncake_store.py","lineNumber":274,"sourceCode":"            ),\n            tenant_id=_normalize_tenant_id(\n                extra_config.get(\"tenant_id\", envs.MOONCAKE_TENANT_ID.default)\n            ),\n        )\n\n\nclass MooncakeBaseStore:\n    def __init__(self):\n        self.store = None\n        self.config = None\n\n    def _import_mooncake_store(self):\n        try:\n            from mooncake.store import MooncakeDistributedStore\n\n            return MooncakeDistributedStore\n        except ImportError as e:\n            raise ImportError(\n                \"Please install mooncake by following the instructions at \"\n                \"https://kvcache-ai.github.io/Mooncake/getting_started/build.html \"\n                \"to run SGLang with MooncakeConnector.\"\n            ) from e\n\n    def _import_mooncake_group_semantics(self):\n        try:\n            from mooncake.store import ReplicateConfig\n        except ImportError:\n            return None, False\n\n        supports_group_ids = hasattr(ReplicateConfig, \"group_ids\")\n        if not supports_group_ids:\n            try:\n                supports_group_ids = hasattr(ReplicateConfig(), \"group_ids\")\n            except Exception:\n                supports_group_ids = False\n        return ReplicateConfig, supports_group_ids","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/mem_cache/storage/mooncake_store/mooncake_store.py#L256-L292","documentation":"`from mooncake.store import MooncakeDistributedStore` raised ImportError, so the Mooncake transfer engine package is not installed in the Python environment. SGLang re-raises with install instructions and the docs URL, chaining the original ImportError.","triggerScenarios":"Using MooncakeConnector/MooncakeStore (e.g. --hicache-storage-backend mooncake) in an environment without mooncakestore/mooncake-transfer-engine installed.","commonSituations":"Default SGLang install (mooncake optional); new venv; broken wheel install leaving a partial module.","solutions":["pip install mooncake-transfer-engine (or build per the linked Mooncake docs)","Or disable the mooncake backend (use file backing) until installed"],"exampleFix":"# before\nOSError/ImportError ... MooncakeConnector\n# after\npip install mooncake-transfer-engine --upgrade\npython -m sglang.launch_server --hicache-storage-backend mooncake ...","handlingStrategy":"validation","validationCode":"def mooncake_available() -> bool:\n    try:\n        from mooncake.store import MooncakeDistributedStore  # noqa\n        return True\n    except ImportError:\n        return False\nassert mooncake_available(), 'pip install mooncake-transfer-engine'","typeGuard":"def mooncake_available() -> bool:\n    try:\n        from mooncake.store import MooncakeDistributedStore  # noqa\n        return True\n    except ImportError:\n        return False","tryCatchPattern":"try:\n    from sglang.srt.mem_cache.storage.mooncake_store.mooncake_store import MooncakeStore\nexcept ImportError as e:\n    if 'install mooncake' in str(e):\n        raise SystemExit('Install mooncake-transfer-engine or use a non-mooncake backend')\n    raise","preventionTips":["Add mooncake-transfer-engine to the environment when using --hicache-storage-backend mooncake","Gate imports behind availability checks in optional-feature code"],"tags":["mooncake","import","missing-dependency","installation"],"backgroundTag":"missing-optional-dependency","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}