can1357/oh-my-pi · error · ArchiveError
Invalid RPM package: tag ${tag} data is misaligned
Error message
Invalid RPM package: tag ${tag} data is misaligned What it means
Fixed-size numeric RPM tag data (INT16/INT32/INT64) must start at an offset aligned to its element size within the data region. This parser enforces natural alignment before reading multi-byte integers, so a misaligned offset indicates a corrupt or malformed header rather than risking misread values.
Source
Thrown at packages/utils/src/ar/rpm.ts:112
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,
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;View on GitHub (pinned to 9690622007)
Solutions
- Treat the file as corrupt: re-download or rebuild the .rpm package.
- Verify with an independent RPM tool to confirm the header is malformed.
- If your own build tooling writes the header, fix its offset/alignment bookkeeping (data is stored in tag order with natural alignment).
- Catch ArchiveError around readRpm and reject the package gracefully.
Defensive patterns
Strategy: try-catch
Try / catch
try {
const entries = await readRpm(source, options);
} catch (err) {
if (err instanceof ArchiveError && err.message.includes("misaligned")) {
return quarantine(file, "corrupt RPM header alignment");
}
throw err;
} Prevention
- Verify package checksums before parsing.
- Avoid custom tooling that writes RPM headers manually; use rpmbuild.
- Quarantine and report files that fail header validation instead of retrying.
When it happens
Trigger: readRpm()/parseMainHeader validates an index entry of type 3/4/5 whose offset field is not divisible by the element size (2/4/8) — e.g. an INT32 tag with offset 3.
Common situations: Bit-level corruption of the offset field; headers hand-assembled by buggy custom tooling; fuzzed inputs targeting integer-reading paths.
Related errors
- Invalid RPM package: string tag ${tag} has an invalid count
- Invalid RPM package: tag ${tag} uses unknown data type ${typ
- Invalid RPM package: tag ${tag} must contain one string
- ARJ member '${memberPath}' has invalid no-data method sizes
- Invalid XZ BCJ filter 0x${filter.id.toString(16)} start offs
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/a26d0f71a54e7f08.
Report an issue: GitHub.