Fission-AI/OpenSpec · error · Error
Expected a directory while verifying ${dir}.
Error message
Expected a directory while verifying ${dir}. What it means
Error "Expected a directory while verifying ${dir}." thrown in Fission-AI/OpenSpec.
Source
Thrown at src/core/archive.ts:400
const lengths = Buffer.allocUnsafe(16);
lengths.writeBigUInt64BE(BigInt(labelBuffer.length), 0);
lengths.writeBigUInt64BE(BigInt(valueBuffer.length), 8);
hash.update(lengths);
hash.update(labelBuffer);
hash.update(valueBuffer);
};
const fingerprintFile = async (filePath: string): Promise<Buffer> => {
const fileHash = createHash('sha256');
for await (const chunk of createReadStream(filePath)) {
fileHash.update(chunk);
}
return fileHash.digest();
};
const visit = async (dir: string, relativeDir: string): Promise<void> => {
const before = await fs.lstat(dir, { bigint: true });
if (!before.isDirectory()) {
throw new Error(`Expected a directory while verifying ${dir}.`);
}
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 });View on GitHub (pinned to 6926ccb18a)
When it happens
Trigger: Thrown at src/core/archive.ts:400 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/473efb41ac6e1b13.
Report an issue: GitHub.