{"record":{"id":"f44abba894991898","repo":"tracel-ai/burn","slug":"notfound","errorCode":"NotFound","errorMessage":"Storage key '{}' not found in TAR archive","messagePattern":"Storage key '(.+?)' not found in TAR archive","errorType":"error_code","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"crates/burn-store/src/pytorch/lazy_data.rs","lineNumber":386,"sourceCode":"\n        Ok(Self {\n            storage_map,\n            storages_data,\n        })\n    }\n\n    /// Read data for a specific storage key\n    pub fn read_file(&self, key: &str) -> std::io::Result<Vec<u8>> {\n        // Extract the storage key from paths like \"data/0\"\n        let storage_key = key.split('/').next_back().unwrap_or(key);\n\n        if let Some(&(offset, size)) = self.storage_map.get(storage_key)\n            && offset + size <= self.storages_data.len()\n        {\n            return Ok(self.storages_data[offset..offset + size].to_vec());\n        }\n\n        Err(std::io::Error::new(\n            std::io::ErrorKind::NotFound,\n            format!(\"Storage key '{}' not found in TAR archive\", storage_key),\n        ))\n    }\n\n    /// Read a range of data for a specific storage key (avoids double allocation)\n    pub fn read_file_range(\n        &self,\n        key: &str,\n        offset: usize,\n        length: usize,\n    ) -> std::io::Result<Vec<u8>> {\n        let storage_key = key.split('/').next_back().unwrap_or(key);\n\n        if let Some(&(storage_offset, storage_size)) = self.storage_map.get(storage_key)\n            && storage_offset + storage_size <= self.storages_data.len()\n        {\n            let start = storage_offset + offset;","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-store/src/pytorch/lazy_data.rs#L368-L404","documentation":"`TarSource::read_file` looks up the storage key (numeric suffix of paths like `data/0`) in the storage map built at construction, and also bounds-checks offset+size against the storages blob. If the key is missing or the recorded range exceeds the blob, it raises NotFound, meaning the requested storage cannot be served from this TAR archive.","triggerScenarios":"Calling `TarSource::read_file(\"data/N\")` (or read_file_range) where N was never recorded during `new` — key not in the storages pickle, parsing stopped early (count pickle read as 0 or a truncated blob), or the blob is shorter than offset+size for that key.","commonSituations":"Requesting a tensor index that doesn't exist in the checkpoint; a truncated download of a .pth file so later storages were never mapped; a storages count pickle that failed to parse leaving the map empty; key-path format mismatches after suffix extraction.","solutions":["Confirm the key exists by listing the archive's tensor/record keys before reading","Re-download or re-export the checkpoint — truncation is the most common cause","Check the file loads eagerly (non-lazy) to distinguish a key problem from a mapping problem","Verify the key path format; only the final `/`-separated segment is used, so pass the full storage path as the reader provides it"],"exampleFix":"// before\nlet bytes = tar_source.read_file(\"data/99\")?; // NotFound\n// after\nlet keys: Vec<_> = tar_source.storage_keys().collect();\nassert!(keys.contains(&\"99\"), \"storage 99 missing; available: {keys:?}\");\nlet bytes = tar_source.read_file(\"data/99\")?;","handlingStrategy":"try-catch","validationCode":"fn storage_available(src: &TarSource, key: &str) -> bool {\n    let storage_key = key.split('/').next_back().unwrap_or(key);\n    src.contains_key(storage_key)\n}","typeGuard":null,"tryCatchPattern":"match tar_source.read_file(key) {\n    Ok(bytes) => bytes,\n    Err(e) if e.kind() == std::io::ErrorKind::NotFound => {\n        return Err(anyhow::anyhow!(\n            \"storage {key} missing from archive; file may be truncated — re-download and retry\"\n        ));\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Verify file size/checksum after downloading .pth files","Enumerate record keys before random-access reads","Avoid manual index arithmetic on `data/N` paths; pass reader-provided keys","Fail fast at load time by doing one eager pass over all storages"],"tags":["io","pytorch","tar","not-found","truncated-file"],"backgroundTag":"storage-key-not-found","analyzedSha":"d16f7ba2ed0d41408189384044cc886fb4c8f957","analyzedAt":"2026-09-05T13:19:14.260Z","contentChangedAt":"2026-09-05T13:19:14.260Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}