{"record":{"id":"55cdb994dddc1cc0","repo":"sgl-project/sglang","slug":"layer-sharded-direct-dsa-indexer-backup-only-suppo","errorCode":null,"errorMessage":"Layer-sharded direct DSA indexer backup only supports layer_first layout, got {self.layout}","messagePattern":"Layer-sharded direct DSA indexer backup only supports layer_first layout, got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/mem_cache/pool_host/dsa.py","lineNumber":328,"sourceCode":"                )\n            elif self.layout == \"page_first\":\n                raise ValueError(\n                    \"Layer-sharded DSA indexer HiCache backup with page_first \"\n                    \"layout is not supported without a per-layer LF->PF kernel.\"\n                )\n            else:\n                raise ValueError(f\"Unsupported layout: {self.layout}\")\n        elif io_backend == \"direct\":\n            if self.layout == \"layer_first\":\n                transfer_kv_direct(\n                    src_layers=[device_pool.index_k_with_scale_buffer[device_layer_id]],\n                    dst_layers=[self.index_k_with_scale_buffer[host_layer_id]],\n                    src_indices=device_page_indices,\n                    dst_indices=host_page_indices,\n                    page_size=1,\n                )\n            else:\n                raise ValueError(\n                    \"Layer-sharded direct DSA indexer backup only supports \"\n                    f\"layer_first layout, got {self.layout}\"\n                )\n        else:\n            raise ValueError(f\"Unsupported IO backend: {io_backend}\")\n\n    def backup_from_device_all_layer(\n        self, device_pool, host_indices, device_indices, io_backend\n    ):\n        if self._is_device_layer_sharded(device_pool):\n            for layer_id in self._owned_device_layer_ids(device_pool):\n                self._backup_from_device_per_layer(\n                    device_pool, host_indices, device_indices, layer_id, io_backend\n                )\n            for draft_layer_id, draft_device_pool in enumerate(\n                self.mtp_draft_device_pools\n            ):\n                self._backup_from_device_per_layer(","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/mem_cache/pool_host/dsa.py#L310-L346","documentation":"In the 'direct' IO backend branch of _backup_from_device_per_layer, only layer_first layout is implemented for layer-sharded backups, so page_first (or any other layout) is rejected with this message.","triggerScenarios":"backup_from_device_all_layer with io_backend='direct', a layer-sharded device pool, and layout='page_first'.","commonSituations":"Combining direct IO backend with page_first host layout while device pool is layer sharded.","solutions":["Use layout='layer_first' with the direct backend","Or use the kernel backend with layer_first (page_first is unsupported for sharded backup there too)"],"exampleFix":"# before\nlayout='page_first'; io_backend='direct'\n# after\nlayout='layer_first'; io_backend='direct'","handlingStrategy":"type-guard","validationCode":"if io_backend == \"direct\" and layer_sharded:\n    assert layout == \"layer_first\"","typeGuard":"def direct_sharded_backup_supported(layout: str) -> bool:\n    return layout == \"layer_first\"","tryCatchPattern":null,"preventionTips":["Pair direct backend exclusively with layer_first"],"tags":["dsa-hicache","layout","io-backend"],"backgroundTag":"unsupported-feature-combination","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}