can1357/oh-my-pi · error · ArchiveError
Invalid RPM package: string tag ${tag} is not NUL-terminated
Error message
Invalid RPM package: string tag ${tag} is not NUL-terminated What it means
RPM strings are stored NUL-terminated in the header data region. When scanning a string-family tag's bytes, if the parser reaches the end of the header data without finding a 0 byte, the string is unterminated — the header is malformed. This also protects against reading past the data region into the payload.
Source
Thrown at packages/utils/src/ar/rpm.ts:104
else if (type === 4) elementSize = 4;
else if (type === 5) elementSize = 8;
else if (type === 0) {
if (count !== 0) throw new ArchiveError(`Invalid RPM package: null tag ${tag} has values`);
continue;
} else if (type === RPM_TYPE_STRING || type === 8 || type === 9) {
const stringCount = type === RPM_TYPE_STRING ? 1 : count;
if (type === RPM_TYPE_STRING && count !== 1) {
throw new ArchiveError(`Invalid RPM package: string tag ${tag} has an invalid count`);
}
if (stringCount > remaining) {
throw new ArchiveError(`Invalid RPM package: string tag ${tag} exceeds header data`);
}
let cursor = indexSize + offset;
const limit = indexSize + intro.dataSize;
for (let stringIndex = 0; stringIndex < stringCount; stringIndex++) {
while (cursor < limit && body[cursor] !== 0) cursor++;
if (cursor === limit) {
throw new ArchiveError(`Invalid RPM package: string tag ${tag} is not NUL-terminated`);
}
cursor++;
}
continue;
} else {
throw new ArchiveError(`Invalid RPM package: tag ${tag} uses unknown data type ${type}`);
}
if (offset % elementSize !== 0) throw new ArchiveError(`Invalid RPM package: tag ${tag} data is misaligned`);
if (count * elementSize > remaining)
throw new ArchiveError(`Invalid RPM package: tag ${tag} exceeds header data`);
}
}
function readHeaderString(
body: Uint8Array,
indexSize: number,
dataSize: number,
offset: number,View on GitHub (pinned to 9690622007)
Solutions
- Re-download or rebuild the package; the header data region is damaged or truncated.
- Compare the file size/checksum against the upstream publish manifest to detect truncation.
- Validate with `rpm -qp` outside this library to confirm the file is bad.
- Catch ArchiveError and skip/reject the package in your ingestion pipeline.
Defensive patterns
Strategy: try-catch
Try / catch
try {
const entries = await readRpm(source, options);
} catch (err) {
if (err instanceof ArchiveError && err.message.includes("not NUL-terminated")) {
return reject("truncated or corrupt RPM header");
}
throw err;
} Prevention
- Verify checksums and full file size (Content-Length) before parsing.
- Use resumable/verified downloads to avoid partial files.
- Test-parse packages at ingest time, before they are needed.
When it happens
Trigger: readRpm()/parseMainHeader validates a header whose string tag's bytes run from its offset to the very end of the data area with no NUL terminator — e.g. a truncated header where the final string's terminator was cut off.
Common situations: Files truncated mid-download (the terminator lives at the end of the data region); corruption flipping the final NUL byte; hand-built headers missing the terminator.
Related errors
- Invalid RPM package: tag ${tag} string is not NUL-terminated
- Invalid RPM package: corrupt ${what} header magic
- Invalid RPM package: corrupt ${what} header reserved bytes
- Invalid RPM package: tag ${tag} points outside header data
- Invalid RPM package: null tag ${tag} has values
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/37746f8cee56b538.
Report an issue: GitHub.