{"record":{"id":"266b955a7b2fb623","repo":"can1357/oh-my-pi","slug":"unsupported-iso-9660-logical-block-size-blocksiz","errorCode":null,"errorMessage":"Unsupported ISO 9660 logical block size ${blockSize} (expected 2048)","messagePattern":"Unsupported ISO 9660 logical block size (.+?) \\(expected 2048\\)","errorType":"exception","errorClass":"ArchiveError","httpStatus":null,"severity":"error","filePath":"packages/utils/src/ar/iso.ts","lineNumber":232,"sourceCode":"\t\tsize,\n\t\textendedAttributeBlocks: bytes[offset + 1]!,\n\t\tmtimeMs: recordingTime(bytes, offset + 18),\n\t\tflags: bytes[offset + 25]!,\n\t\tfileUnitSize,\n\t\tinterleaveGapSize,\n\t\tidentifier: bytes.subarray(offset + 33, offset + 33 + identifierLength),\n\t\tsystemUse: bytes.subarray(offset + systemUseOffset, offset + length),\n\t};\n}\n\nfunction parseVolumeDescriptor(descriptor: Uint8Array, joliet: boolean): IsoVolume {\n\tbothEndian32(descriptor, 80, \"volume space size\");\n\tbothEndian16(descriptor, 120, \"volume set size\");\n\tbothEndian16(descriptor, 124, \"volume sequence number\");\n\tconst blockSize = bothEndian16(descriptor, 128, \"logical block size\");\n\tbothEndian32(descriptor, 132, \"path table size\");\n\tif (blockSize !== ISO_SECTOR_SIZE) {\n\t\tthrow new ArchiveError(`Unsupported ISO 9660 logical block size ${blockSize} (expected 2048)`);\n\t}\n\tconst root = parseRecord(descriptor, 156, descriptor.byteLength - 156, \"root\");\n\tif ((root.flags & 0x02) === 0 || root.size === 0 || root.identifier.byteLength !== 1 || root.identifier[0] !== 0) {\n\t\tthrow invalidIso(\"invalid root directory record\");\n\t}\n\treturn { blockSize, root, joliet };\n}\n\nasync function readVolume(source: ByteSource, budget: MetadataBudget, limits: ArchiveLimits): Promise<IsoVolume> {\n\tif (source.size < VOLUME_DESCRIPTOR_START + ISO_SECTOR_SIZE) throw invalidIso(\"truncated volume descriptor set\");\n\tlet position = VOLUME_DESCRIPTOR_START;\n\tlet chunkSectors = 16;\n\tlet pending: Uint8Array = new Uint8Array(0);\n\tlet pendingOffset = 0;\n\tlet primary: IsoVolume | undefined;\n\tlet joliet: IsoVolume | undefined;\n\tlet sawUdf = false;\n\tlet sawHighSierra = false;","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/utils/src/ar/iso.ts#L214-L250","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-create the ISO with a conformant tool: genisoimage/mkisofs/xorriso (which always emit 2048-byte blocks)","Convert the non-2048 image with a tool that re-sectors it to standard ISO 9660","If you control generation, fix the block size field in the authoring pipeline","Inspect offset 128 of the volume descriptor to confirm the actual declared block size before blaming the reader"],"exampleFix":"// before (nonstandard authoring)\n$ oldtool -blocksize 512 -o image.iso dir/   # throws at parse time\n// after\n$ xorriso -as mkisofs -o image.iso dir/      # 2048-byte blocks","handlingStrategy":"validation","validationCode":"// sector 16 (offset 32768) primary descriptor; block size at descriptor offset 128\nconst buf = new Uint8Array(await Bun.file(path).slice(32768, 32768 + 2048).arrayBuffer());\nconst blockSize = (buf[128] << 8) | buf[129]; // big-endian half of both-endian field\nif (blockSize !== 2048) throw new Error(`nonstandard ISO block size ${blockSize}`);","typeGuard":"null","tryCatchPattern":"try {\n  vol = await readIso(image);\n} catch (err) {\n  if (err instanceof ArchiveError && /logical block size/.test(err.message)) {\n    // re-sector or re-master the image with xorriso before retrying\n  } else throw err;\n}","preventionTips":["Author ISOs with modern tools (xorriso/genisoimage) which always use 2048-byte blocks","Reject non-2048 block sizes at ingestion","Don't hand-edit volume descriptor fields"],"tags":["iso9660","archive","block-size","unsupported-format"],"backgroundTag":"unsupported-iso-block-size","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}