Unexpected record 0x3b error when reading buffer #3286

Closed
opened 2025-02-26 21:06:31 +00:00 by travisskyles · 6 comments

Trying to read an .xlsb file as a buffer and running into a an error that states Unexpected record 0x3b.

Having no problems with other similarly formatted files. Hoping that you all might have a better idea as to the underlying issue here as I've been unable to dig up any answers.

Thanks

Trying to read an .xlsb file as a buffer and running into a an error that states `Unexpected record 0x3b`. Having no problems with other similarly formatted files. Hoping that you all might have a better idea as to the underlying issue here as I've been unable to dig up any answers. Thanks
Collaborator

0x3B is part of Excel's binary format it could be related to BrtIndexedColor record in BIFF12 spec, if so it could be part of the color palette definition. If possible, can you please share the file you were trying to read and the options you were using while reading it?

`0x3B` is part of Excel's binary format it could be related to `BrtIndexedColor` record in `BIFF12` spec, if so it could be part of the color palette definition. If possible, can you please share the file you were trying to read and the options you were using while reading it?
Owner

If you can share the file, we can take a closer look. If you can't, please try reading with the option WTF: 1 and share the error.

If you can share the file, we can take a closer look. If you can't, please try reading with the option [`WTF: 1`](https://docs.sheetjs.com/docs/api/parse-options#parsing-options) and share the error.
Author

Hi, unfortunately we were not able to get a file that we can share to duplicate the error but I ran it with these options { type: 'buffer', cellDates: true, WTF: true } and this is the error that was given:

Error: Unexpected record 0x3b
    at file:///Users/travis/sunscreen-monorepo/node_modules/xlsx/xlsx.mjs:12367:17
    at recordhopper (file:///Users/travis/sunscreen-monorepo/node_modules/xlsx/xlsx.mjs:4381:6)
    at parse_xlmeta_bin (file:///Users/travis/sunscreen-monorepo/node_modules/xlsx/xlsx.mjs:12337:3)
    at parse_xlmeta (file:///Users/travis/sunscreen-monorepo/node_modules/xlsx/xlsx.mjs:18489:37)
    at parse_zip (file:///Users/travis/sunscreen-monorepo/node_modules/xlsx/xlsx.mjs:26572:17)
    at read_zip (file:///Users/travis/sunscreen-monorepo/node_modules/xlsx/xlsx.mjs:27025:9)
    at readSync (file:///Users/travis/sunscreen-monorepo/node_modules/xlsx/xlsx.mjs:27103:69)
    at readFromBuffer (/Users/travis/sunscreen-monorepo/libs/util/excel/src/lib/read.ts:5:10)
    at Object.saveVendorLabor (/Users/travis/sunscreen-monorepo/libs/sunscreen/api/labor-vendor-reported/src/lib/labor-reported-data-source/aerotek.service.ts:139:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
Hi, unfortunately we were not able to get a file that we can share to duplicate the error but I ran it with these options `{ type: 'buffer', cellDates: true, WTF: true }` and this is the error that was given: ``` Error: Unexpected record 0x3b at file:///Users/travis/sunscreen-monorepo/node_modules/xlsx/xlsx.mjs:12367:17 at recordhopper (file:///Users/travis/sunscreen-monorepo/node_modules/xlsx/xlsx.mjs:4381:6) at parse_xlmeta_bin (file:///Users/travis/sunscreen-monorepo/node_modules/xlsx/xlsx.mjs:12337:3) at parse_xlmeta (file:///Users/travis/sunscreen-monorepo/node_modules/xlsx/xlsx.mjs:18489:37) at parse_zip (file:///Users/travis/sunscreen-monorepo/node_modules/xlsx/xlsx.mjs:26572:17) at read_zip (file:///Users/travis/sunscreen-monorepo/node_modules/xlsx/xlsx.mjs:27025:9) at readSync (file:///Users/travis/sunscreen-monorepo/node_modules/xlsx/xlsx.mjs:27103:69) at readFromBuffer (/Users/travis/sunscreen-monorepo/libs/util/excel/src/lib/read.ts:5:10) at Object.saveVendorLabor (/Users/travis/sunscreen-monorepo/libs/sunscreen/api/labor-vendor-reported/src/lib/labor-reported-data-source/aerotek.service.ts:139:23) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) ```
Collaborator

Thank you for sharing this! We've identified the issue this error is omitting because SheetJS-CE is not checking for the record BrtStr.

We've noted this and will work on adding support for it.

0x3b = 59
2.3.2 By Number

Thank you for sharing this! We've identified the issue this error is omitting because SheetJS-CE is not checking for the record [`BrtStr`](https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-xlsb/2c033bd3-7d98-49c3-a856-05103cca650e). We've noted this and will work on adding support for it. `0x3b` = `59` [`2.3.2 By Number`](https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-xlsb/30e2eaae-0b1e-4e8e-a465-e1ce5575868d)
Author

Great, thanks!

Great, thanks!
Owner

It looks like Microsoft had a bad docs update earlier this month (version 20.0, 2025-04-04). There are numerous references to ABNF grammar files that were never added to the docs. For example, https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-xlsb/be874d90-2b52-4141-b7d7-d33426a615f3 merely states

Record sequence ABNF:

O25FileFormatDefinitions\excel12\cpp\ValidationABNFs\Biff12WorkbookGrammar.abnf

The upcoming commit should cover the records through version 19.0 (2025-02-18).

It looks like Microsoft had a bad docs update earlier this month (version 20.0, 2025-04-04). There are numerous references to ABNF grammar files that were never added to the docs. For example, https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-xlsb/be874d90-2b52-4141-b7d7-d33426a615f3 merely states > Record sequence ABNF: > > O25FileFormatDefinitions\excel12\cpp\ValidationABNFs\Biff12WorkbookGrammar.abnf The upcoming commit should cover the records through version 19.0 (2025-02-18).
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#3286
No description provided.