Fission-AI/OpenSpec · error · Error
Path changed while archive was reading
Error message
Path changed while archive was reading ${entryPath}. What it means
Race guard in the archive fingerprint walk: an entry's lstat identity changed between the initial stat and the post-read re-stat, so the file was modified or replaced while being hashed. Throws to avoid producing a fingerprint of mixed content.
Solutions
- Stop concurrent writers to the change directory and re-run archive
- Re-run once the file being modified is closed
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/core/archive.ts:420 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Fission-AI/OpenSpec@6926ccb18a (2026-08-25).
Data as JSON: /api/errors/16c0cb77474a2def.
Report an issue: GitHub.
Appendix: source
Thrown at src/core/archive.ts:420
updateHashField('directory-mode', (before.mode & 0o7777n).toString());
const entries = (await fs.readdir(dir, { withFileTypes: true })).sort((a, b) =>
a.name < b.name ? -1 : a.name > b.name ? 1 : 0
);
for (const entry of entries) {
const entryPath = path.join(dir, entry.name);
const relativePath = path.join(relativeDir, entry.name);
const stat = await fs.lstat(entryPath, { bigint: true });
updateHashField('path', relativePath);
if (stat.isDirectory()) {
updateHashField('type', 'directory');
await visit(entryPath, relativePath);
} else if (stat.isSymbolicLink()) {
const target = await fs.readlink(entryPath);
const after = await fs.lstat(entryPath, { bigint: true });
if (statIdentity(stat) !== statIdentity(after)) {
throw new Error(`Path changed while archive was reading ${entryPath}.`);
}
updateHashField('type', 'symlink');
updateHashField('target', target);
} else if (stat.isFile()) {
const contentFingerprint = await fingerprintFile(entryPath);
const after = await fs.lstat(entryPath, { bigint: true });
if (statIdentity(stat) !== statIdentity(after)) {
throw new Error(`Path changed while archive was reading ${entryPath}.`);
}
updateHashField('type', 'file');
updateHashField('mode', (stat.mode & 0o7777n).toString());
updateHashField('content-sha256', contentFingerprint);
} else {
updateHashField('type', 'other');
updateHashField('mode', stat.mode.toString());
updateHashField('size', stat.size.toString());
}
}View on GitHub (pinned to 6926ccb18a)