can1357/oh-my-pi · error · ArchiveError
Invalid RPM package: tag ${tag} exceeds header data
Error message
Invalid RPM package: tag ${tag} exceeds header data What it means
For fixed-size numeric/binary tag types, the parser checks that count * elementSize bytes actually fit between the tag's offset and the end of the header data region. An overrun means the index entry claims more data than exists, so the header is inconsistent and the package is rejected.
Source
Thrown at packages/utils/src/ar/rpm.ts:114
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,
count: number,
type: number,
tag: number,
): string {
if (type !== RPM_TYPE_STRING || count !== 1) {
throw new ArchiveError(`Invalid RPM package: tag ${tag} must contain one string`);
}
const start = indexSize + offset;
const limit = indexSize + dataSize;
let end = start;View on GitHub (pinned to 9690622007)
Solutions
- Re-download or rebuild the package — the header cannot be trusted.
- Check file size against the upstream checksum to detect truncation.
- Confirm with `rpm -qp` that the file is genuinely malformed.
- Handle ArchiveError in your pipeline and skip the package with a logged reason.
Defensive patterns
Strategy: try-catch
Validate before calling
if (fileSize < expectedMinimumSize) throw new Error("file too small to be a complete RPM"); Try / catch
try {
const entries = await readRpm(source, options);
} catch (err) {
if (err instanceof ArchiveError && err.message.includes("exceeds header data")) {
return { ok: false, reason: "truncated RPM header" };
}
throw err;
} Prevention
- Compare downloaded file size and hash with the repository manifest before parsing.
- Fail fast on truncated transfers rather than passing partial files to the parser.
- Restrict parsing to packages from signed, trusted repositories.
When it happens
Trigger: readRpm()/parseMainHeader validates an index entry whose count * elementSize exceeds dataSize - offset, e.g. an INT32 tag with count 10 but only 8 bytes remaining in the data region.
Common situations: Truncated .rpm files (header data cut off mid-region); corrupted count or offset fields; crafted packages attempting to make the parser read out of bounds.
Related errors
- Invalid RPM package: tag ${tag} points outside header data
- Invalid RPM package: string tag ${tag} exceeds header data
- Invalid CAB archive: metadata range is out of bounds
- Invalid RPM package: corrupt ${what} header magic
- Invalid RPM package: corrupt ${what} header reserved bytes
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/de8d9324facd454c.
Report an issue: GitHub.