{"record":{"id":"b78b1d63e7b9dd8a","repo":"sgl-project/sglang","slug":"lora-with-name-lora-name-does-not-exist-loaded","errorCode":null,"errorMessage":"LoRA with name {lora_name} does not exist. Loaded LoRAs: {self._registry.keys()}","messagePattern":"LoRA with name (.+?) does not exist\\. Loaded LoRAs: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/lora/lora_registry.py","lineNumber":119,"sourceCode":"        Register a new LoRARef object in the registry.\n\n        Args:\n            lora_ref (LoRARef): The LoRARef object to register.\n        \"\"\"\n        async with self._registry_lock.writer_lock:\n            self._register_adapter(lora_ref)\n\n    async def unregister(self, lora_name: str) -> str:\n        \"\"\"\n        Unregister a LoRARef object from the registry and returns the removed LoRA ID.\n\n        Args:\n            lora_name (str): The name of the LoRA model to unregister.\n        \"\"\"\n        async with self._registry_lock.writer_lock:\n            lora_ref = self._registry.get(lora_name, None)\n            if lora_ref is None:\n                raise ValueError(\n                    f\"LoRA with name {lora_name} does not exist. Loaded LoRAs: {self._registry.keys()}\"\n                )\n            del self._registry[lora_name]\n\n        return lora_ref.lora_id\n\n    async def acquire(self, lora_name: Union[str, List[str]]) -> Union[str, List[str]]:\n        \"\"\"\n        Queries registry for LoRA IDs based on LoRA names and start tracking the usage of the corresponding LoRA adapters\n        by incrementing its counter.\n        \"\"\"\n\n        def _lookup(name: str) -> str:\n            if name is None:\n                return None\n\n            lora_ref = self._registry.get(name, None)\n            if lora_ref is None:","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/lora/lora_registry.py#L101-L137","documentation":"Raised by LoRARegistry.unregister when asked to unregister a LoRA name that is not present in the registry. The registry is the source of truth for loaded adapters; attempts to remove a never-loaded, already-unregistered, or misspelled adapter fail here.","triggerScenarios":"Calling the unregister API (e.g. /unload_lora_adapter) with a name absent from self._registry — after a prior unload, a typo, or before any load.","commonSituations":"Double-unload due to a retried HTTP request; client-side name mismatch with the adapter actually loaded; cleanup code that assumes an adapter exists.","solutions":["Check the loaded adapter list in the error message and use the exact name","Guard the unload call with a contains/lookup check first","Avoid retrying unload requests after success"],"exampleFix":"# before\nawait registry.unregister('adptr')  # typo\n# after\nif 'adptr' in registry._registry:\n    await registry.unregister('adptr')\n# or simply use the exact name: 'adapter1'","handlingStrategy":"validation","validationCode":"if lora_name not in registry._registry:\n    raise KeyError(f'cannot unload unknown adapter {lora_name}; loaded: {list(registry._registry)}')","typeGuard":null,"tryCatchPattern":"try:\n    await registry.unregister(lora_name)\nexcept ValueError:\n    pass  # already unloaded — treat as success for idempotent cleanup","preventionTips":["Make unload paths idempotent (tolerate already-removed)","Copy names exactly from the load response"],"tags":["lora","registry","not-found","unload","sglang"],"backgroundTag":"resource-not-found","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}