astrid-runtime/astrid · error
read projected file {}: {error}
Error message
read projected file {}: {error} What it means
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.
Source
Thrown at crates/astrid-kernel/src/lib.rs:1681
}
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
fn read_projection_file_nofollow(path: &Path) -> anyhow::Result<Vec<u8>> {
use std::io::Read as _;
let metadata = std::fs::symlink_metadata(path).map_err(|error| {
anyhow::anyhow!("inspect projected file {}: {error}", path.display())
})?;
if metadata.file_type().is_symlink() || !metadata.is_file() {
anyhow::bail!(
"projected path is redirected or not a regular file: {}",
path.display()
);
}
let mut file = open_projection_file_nofollow(path)?;
let mut bytes = Vec::new();
file.read_to_end(&mut bytes)
.map_err(|error| anyhow::anyhow!("read projected file {}: {error}", path.display()))?;
if file.metadata()?.len() != metadata.len() || bytes.len() as u64 != metadata.len() {
anyhow::bail!("projected file changed while read: {}", path.display());
}
Ok(bytes)
}
/// Load a capsule into the Kernel from a directory containing a Capsule.toml
///
/// # Errors
///
/// Returns an error if the manifest cannot be loaded, the capsule cannot be created, or registration fails.
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
async fn load_capsule(
&self,
dir: PathBuf,
principal: &PrincipalId,
) -> Result<(), anyhow::Error> {
self.verify_workspace_capsule_tree(&dir)?;View on GitHub (pinned to affd8760f4)
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.
Defensive patterns
Strategy: retry
Try / catch
let bytes = loop {
match read_projection_file_nofollow(path) {
Ok(b) => break b,
Err(e) if e.to_string().contains("read projected file") && attempts < 3 => { attempts += 1; continue; }
Err(e) => return Err(e),
}
}; Prevention
- Freeze projection mutations during reads.
- Retry transient IO errors with backoff.
- Monitor disk health; investigate persistent read failures.
When it happens
Trigger: Read error mid-stream: disk IO error, file truncated/removed after open, or descriptor issues on network filesystems.
Common situations: 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.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- read capsule projection {}: {error}
- read capsule projection entry: {error}
- inspect capsule projection {}: {error}
- inspect projected file {}: {error}
- legacy state source is redirected: {}
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/f086b2b81d0014c9.
Report an issue: GitHub.