{"record":{"id":"f086b2b81d0014c9","repo":"astrid-runtime/astrid","slug":"read-projected-file-error","errorCode":null,"errorMessage":"read projected file {}: {error}","messagePattern":"read projected file (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-kernel/src/lib.rs","lineNumber":1681,"sourceCode":"    }\n\n    #[cfg(not(all(target_arch = \"wasm32\", target_os = \"unknown\")))]\n    fn read_projection_file_nofollow(path: &Path) -> anyhow::Result<Vec<u8>> {\n        use std::io::Read as _;\n\n        let metadata = std::fs::symlink_metadata(path).map_err(|error| {\n            anyhow::anyhow!(\"inspect projected file {}: {error}\", path.display())\n        })?;\n        if metadata.file_type().is_symlink() || !metadata.is_file() {\n            anyhow::bail!(\n                \"projected path is redirected or not a regular file: {}\",\n                path.display()\n            );\n        }\n        let mut file = open_projection_file_nofollow(path)?;\n        let mut bytes = Vec::new();\n        file.read_to_end(&mut bytes)\n            .map_err(|error| anyhow::anyhow!(\"read projected file {}: {error}\", path.display()))?;\n        if file.metadata()?.len() != metadata.len() || bytes.len() as u64 != metadata.len() {\n            anyhow::bail!(\"projected file changed while read: {}\", path.display());\n        }\n        Ok(bytes)\n    }\n\n    /// Load a capsule into the Kernel from a directory containing a Capsule.toml\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the manifest cannot be loaded, the capsule cannot be created, or registration fails.\n    #[cfg(not(all(target_arch = \"wasm32\", target_os = \"unknown\")))]\n    async fn load_capsule(\n        &self,\n        dir: PathBuf,\n        principal: &PrincipalId,\n    ) -> Result<(), anyhow::Error> {\n        self.verify_workspace_capsule_tree(&dir)?;","sourceCodeStart":1663,"sourceCodeEnd":1699,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-kernel/src/lib.rs#L1663-L1699","documentation":"Thrown when `read_to_end` fails while reading the contents of a projected file in `read_projection_file_nofollow`. The file was successfully opened (via open_projection_file_nofollow) but the actual read IO failed; the path is included in the message.","triggerScenarios":"Read error mid-stream: disk IO error, file truncated/removed after open, or descriptor issues on network filesystems.","commonSituations":"Projection mutated concurrently (file replaced between open and read — note a separate 'changed while read' error covers size mismatch, this one covers hard IO failures); failing disk; NFS stale file handle.","solutions":["Retry the read; transient IO failures usually clear on a fresh attempt.","Freeze mutations to the projection during reads (quiesce writers).","Check disk/filesystem health for the underlying error.","If on a network mount, verify the export/handle is still valid."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"let bytes = loop {\n    match read_projection_file_nofollow(path) {\n        Ok(b) => break b,\n        Err(e) if e.to_string().contains(\"read projected file\") && attempts < 3 => { attempts += 1; continue; }\n        Err(e) => return Err(e),\n    }\n};","preventionTips":["Freeze projection mutations during reads.","Retry transient IO errors with backoff.","Monitor disk health; investigate persistent read failures."],"tags":["filesystem","io","rust","read"],"backgroundTag":"file-read-failed","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}