paperclipai/paperclip · error · Error
Invalid zip archive: central directory declares ${declaredEn
Error message
Invalid zip archive: central directory declares ${declaredEntryCount} entries but ${localHeaderCount} local entries were read (truncated or corrupt). What it means
Error "Invalid zip archive: central directory declares ${declaredEntryCount} entries but ${localHeaderCount} local entries were read (truncated or corrupt)." thrown in paperclipai/paperclip.
Source
Thrown at packages/shared/src/portability-zip.ts:121
if (cursor + 46 > directoryEnd || readUint32(bytes, cursor) !== CENTRAL_DIRECTORY_SIGNATURE) {
throw new Error("Invalid zip archive: malformed central directory record.");
}
const fileNameLength = readUint16(bytes, cursor + 28);
const extraFieldLength = readUint16(bytes, cursor + 30);
const commentLength = readUint16(bytes, cursor + 32);
const localHeaderOffset = readUint32(bytes, cursor + 42);
if (localHeaderOffset + 4 > bytes.length || readUint32(bytes, localHeaderOffset) !== LOCAL_FILE_SIGNATURE) {
throw new Error("Invalid zip archive: central directory references a missing local entry.");
}
cursor += 46 + fileNameLength + extraFieldLength + commentLength;
recordCount += 1;
}
if (cursor !== directoryEnd) {
throw new Error("Invalid zip archive: central directory size does not match its records.");
}
if (recordCount !== declaredEntryCount || recordCount !== localHeaderCount) {
throw new Error(
`Invalid zip archive: central directory declares ${declaredEntryCount} entries but ${localHeaderCount} local entries were read (truncated or corrupt).`,
);
}
}
function sharedArchiveRoot(paths: string[]) {
if (paths.length === 0) return null;
const firstSegments = paths
.map((entry) => normalizeArchivePath(entry).split("/").filter(Boolean))
.filter((parts) => parts.length > 0);
if (firstSegments.length === 0) return null;
const candidate = firstSegments[0]![0]!;
return firstSegments.every((parts) => parts.length > 1 && parts[0] === candidate)
? candidate
: null;
}
export function isBlobStorePath(pathValue: string) {View on GitHub (pinned to 120ae5428f)
Solutions
- Re-download the complete archive; entry counts are inconsistent (truncated/corrupt).
When it happens
Trigger: Thrown at packages/shared/src/portability-zip.ts:121 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18).
Data as JSON: /api/errors/999483e4e74342c2.
Report an issue: GitHub.