{"record":{"id":"a138bbd95930b426","repo":"Lightning-AI/pytorch-lightning","slug":"the-path-str-path-r-does-not-point-to-a-valid-f","errorCode":null,"errorMessage":"The path {str(path)!r} does not point to a valid full checkpoint. Make sure the path points to a directory with a full XLAFSDP checkpoint.","messagePattern":"The path (.+?) does not point to a valid full checkpoint\\. Make sure the path points to a directory with a full XLAFSDP checkpoint\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/lightning/fabric/strategies/xla_fsdp.py","lineNumber":596,"sourceCode":"            for key in requested_metadata_keys:\n                if key in loaded_metadata_keys:\n                    state[key] = sharded_ckpt[key]\n                    loaded_metadata_keys.remove(key)\n\n            metadata = {}\n            if len(loaded_metadata_keys):\n                for key in loaded_metadata_keys:\n                    metadata[key] = sharded_ckpt[key]\n\n            # remove \"shard_metadata\" that is loaded in\n            if \"shard_metadata\" in metadata:\n                metadata.pop(\"shard_metadata\")\n\n            return metadata\n\n        if self._state_dict_type == \"full\":\n            if not path.is_file():\n                raise ValueError(\n                    f\"The path {str(path)!r} does not point to a valid full checkpoint. Make sure the path points to a\"\n                    \" directory with a full XLAFSDP checkpoint.\"\n                )\n            if len(optimizers) > 0 or len(state.keys() - modules.keys() - optimizers.keys()) > 0:\n                rank_zero_warn(\n                    \"Loading a full checkpoint will only load the full model.\"\n                    \" The optimizer and any additional metadata are not included.\"\n                )\n            if len(modules) > 0:\n                raise ValueError(\n                    \"Found a XLAFSDP model in the provided checkpoint state.\"\n                    \" Please provide the model without any XLAFSDP wrapper.\"\n                )\n            if \"model\" not in state or not isinstance(model := state[\"model\"], torch.nn.Module):\n                raise NotImplementedError(\"XLAFSDP only supports a single model instance with 'model' as the key.\")\n            full_ckpt = torch.load(path, weights_only=weights_only)\n            model.load_state_dict(full_ckpt.pop(\"model\"), strict=strict)\n            return full_ckpt","sourceCodeStart":578,"sourceCodeEnd":614,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/fabric/strategies/xla_fsdp.py#L578-L614","documentation":"When state_dict_type='full', load_checkpoint expects path to be the consolidated single checkpoint file (not the shard directory). The source checks path.is_file(); if the path is a directory of shards (or nonexistent), the full-checkpoint load cannot proceed. The message text about 'a directory with a full checkpoint' is slightly misleading — the path must be a file.","triggerScenarios":"Passing the sharded checkpoint directory (produced by state_dict_type='sharded') while the strategy is configured with state_dict_type='full'; passing a typo'd or nonexistent file path.","commonSituations":"Switching strategy config from sharded to full without re-consolidating the checkpoint; resume scripts that always pass the save directory; mixing conventions from other Lightning strategies where checkpoints are files.","solutions":["Point path at the consolidated full checkpoint file (e.g. produced by consolidate_sharded_ckpts)","If you only have shards, either load with state_dict_type='sharded' or run torch_xla's consolidate_sharded_ckpts to build the full file first","Verify the file exists before calling load_checkpoint"],"exampleFix":"# before\nstrategy = XLAFSDPStrategy(state_dict_type='full')\nfabric.load_checkpoint('ckpt/shards/', state={'model': model})\n\n# after\nstrategy = XLAFSDPStrategy(state_dict_type='full')\nfabric.load_checkpoint('ckpt/consolidated.ckpt', state={'model': model})","handlingStrategy":"validation","validationCode":"from pathlib import Path\nif strategy_state_dict_type == 'full':\n    assert Path(ckpt).is_file(), 'full load requires the consolidated .ckpt file path, not the shard dir'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Store the checkpoint kind (full file vs shard dir) in run metadata","Use different naming conventions for consolidated files vs shard directories"],"tags":["xla","fsdp","checkpoint","load","full-checkpoint","file-not-found","lightning-fabric"],"backgroundTag":"checkpoint-file-not-found","analyzedSha":"9fed5c27d2a62ff0efd6c3573599921d6ff67c14","analyzedAt":"2026-08-28T11:52:41.083Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}