can1357/oh-my-pi · error · ArchiveError

Unsupported ISO 9660 logical block size ${blockSize} (expect

Error message

Unsupported ISO 9660 logical block size ${blockSize} (expected 2048)

What it means

ISO 9660 mandates a 2048-byte logical block size, stored in the primary volume descriptor. The parser read a different blockSize from the descriptor at offset 128 (both-endian) and refuses to continue, since record/extent math in this implementation assumes 2048-byte sectors.

Source

Thrown at packages/utils/src/ar/iso.ts:232

		size,
		extendedAttributeBlocks: bytes[offset + 1]!,
		mtimeMs: recordingTime(bytes, offset + 18),
		flags: bytes[offset + 25]!,
		fileUnitSize,
		interleaveGapSize,
		identifier: bytes.subarray(offset + 33, offset + 33 + identifierLength),
		systemUse: bytes.subarray(offset + systemUseOffset, offset + length),
	};
}

function parseVolumeDescriptor(descriptor: Uint8Array, joliet: boolean): IsoVolume {
	bothEndian32(descriptor, 80, "volume space size");
	bothEndian16(descriptor, 120, "volume set size");
	bothEndian16(descriptor, 124, "volume sequence number");
	const blockSize = bothEndian16(descriptor, 128, "logical block size");
	bothEndian32(descriptor, 132, "path table size");
	if (blockSize !== ISO_SECTOR_SIZE) {
		throw new ArchiveError(`Unsupported ISO 9660 logical block size ${blockSize} (expected 2048)`);
	}
	const root = parseRecord(descriptor, 156, descriptor.byteLength - 156, "root");
	if ((root.flags & 0x02) === 0 || root.size === 0 || root.identifier.byteLength !== 1 || root.identifier[0] !== 0) {
		throw invalidIso("invalid root directory record");
	}
	return { blockSize, root, joliet };
}

async function readVolume(source: ByteSource, budget: MetadataBudget, limits: ArchiveLimits): Promise<IsoVolume> {
	if (source.size < VOLUME_DESCRIPTOR_START + ISO_SECTOR_SIZE) throw invalidIso("truncated volume descriptor set");
	let position = VOLUME_DESCRIPTOR_START;
	let chunkSectors = 16;
	let pending: Uint8Array = new Uint8Array(0);
	let pendingOffset = 0;
	let primary: IsoVolume | undefined;
	let joliet: IsoVolume | undefined;
	let sawUdf = false;
	let sawHighSierra = false;

View on GitHub (pinned to 9690622007)

Solutions

  1. Re-create the ISO with a conformant tool: genisoimage/mkisofs/xorriso (which always emit 2048-byte blocks)
  2. Convert the non-2048 image with a tool that re-sectors it to standard ISO 9660
  3. If you control generation, fix the block size field in the authoring pipeline
  4. Inspect offset 128 of the volume descriptor to confirm the actual declared block size before blaming the reader

Example fix

// before (nonstandard authoring)
$ oldtool -blocksize 512 -o image.iso dir/   # throws at parse time
// after
$ xorriso -as mkisofs -o image.iso dir/      # 2048-byte blocks
Defensive patterns

Strategy: validation

Validate before calling

// sector 16 (offset 32768) primary descriptor; block size at descriptor offset 128
const buf = new Uint8Array(await Bun.file(path).slice(32768, 32768 + 2048).arrayBuffer());
const blockSize = (buf[128] << 8) | buf[129]; // big-endian half of both-endian field
if (blockSize !== 2048) throw new Error(`nonstandard ISO block size ${blockSize}`);

Type guard

null

Try / catch

try {
  vol = await readIso(image);
} catch (err) {
  if (err instanceof ArchiveError && /logical block size/.test(err.message)) {
    // re-sector or re-master the image with xorriso before retrying
  } else throw err;
}

Prevention

When it happens

Trigger: Calling the ISO reader (via readVolume -> parseVolumeDescriptor) on an image whose primary volume descriptor declares a logical block size other than 2048 — most classically a 512-byte or 1024-byte block High Sierra/early CD-ROM image, or a synthetically generated descriptor with a bad value.

Common situations: Mounting/inspecting pre-ISO 9660 High Sierra discs converted to image files, images produced by nonconformant authoring tools, or descriptors corrupted at the block-size fields.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/266b955a7b2fb623. Report an issue: GitHub.