[GH-ISSUE #227] ZIP errors are not specified #183

Closed
opened 2026-05-05 11:50:52 -06:00 by gitea-mirror · 6 comments
Owner

Originally created by @evanmiller on GitHub (May 14, 2019).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/227

Originally assigned to: @jmcnamara on GitHub.

I am getting an error when creating a large XLSX file (2,000+ columns, 100,000+ rows).

[ERROR][/Code/libxlsxwriter/src/packager.c:1103]: Error in closing member in the zipfile
[ERROR] workbook_close(): Zlib error adding file to xlsx file '/private/tmp/Albania - Estonia.xlsx'.

The logic of RETURN_ON_ZIP_ERROR indicates that the error is not ZIP_ERRNO (née Z_ERRNO) - however, I do not know what the actual error code is. Any way to bubble this up so I can access it from client code?

Originally created by @evanmiller on GitHub (May 14, 2019). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/227 Originally assigned to: @jmcnamara on GitHub. I am getting an error when creating a large XLSX file (2,000+ columns, 100,000+ rows). ``` [ERROR][/Code/libxlsxwriter/src/packager.c:1103]: Error in closing member in the zipfile [ERROR] workbook_close(): Zlib error adding file to xlsx file '/private/tmp/Albania - Estonia.xlsx'. ``` The logic of `RETURN_ON_ZIP_ERROR` indicates that the error is not `ZIP_ERRNO` (née `Z_ERRNO`) - however, I do not know what the actual error code is. Any way to bubble this up so I can access it from client code?
gitea-mirror 2026-05-05 11:50:52 -06:00
Author
Owner

@jmcnamara commented on GitHub (May 15, 2019):

Any way to bubble this up so I can access it from client code?

Not without remapping all the zlib error codes. There are only 6 so that is probably doable. However, the zlib error codes aren't hugely informative either so they probably wouldn't be very useful to you anyway. See: https://www.zlib.net/manual.html

<!-- gh-comment-id:492608950 --> @jmcnamara commented on GitHub (May 15, 2019): > Any way to bubble this up so I can access it from client code? Not without remapping all the zlib error codes. There are only 6 so that is probably doable. However, the zlib error codes aren't hugely informative either so they probably wouldn't be very useful to you anyway. See: https://www.zlib.net/manual.html
Author
Owner

@evanmiller commented on GitHub (May 15, 2019):

Distinct from the Zlib errors there are the ZIP errors, which would help me narrow down the offending code path.

b616fb59ff/include/xlsxwriter/third_party/zip.h (L88-L90)

<!-- gh-comment-id:492614198 --> @evanmiller commented on GitHub (May 15, 2019): Distinct from the Zlib errors there are the ZIP errors, which would help me narrow down the offending code path. https://github.com/jmcnamara/libxlsxwriter/blob/b616fb59ffe0268b1ee0cecf822bf8ed45cf4f30/include/xlsxwriter/third_party/zip.h#L88-L90
Author
Owner

@evanmiller commented on GitHub (May 15, 2019):

I should also add: The library's error messages incorrectly report all ZIP errors as Zlib errors.

<!-- gh-comment-id:492614930 --> @evanmiller commented on GitHub (May 15, 2019): I should also add: The library's error messages incorrectly report all ZIP errors as Zlib errors.
Author
Owner

@jmcnamara commented on GitHub (May 15, 2019):

I should also add: The library's error messages incorrectly report all ZIP errors as Zlib errors.

Ah yes. Thanks.

<!-- gh-comment-id:492629852 --> @jmcnamara commented on GitHub (May 15, 2019): > I should also add: The library's error messages incorrectly report all ZIP errors as Zlib errors. Ah yes. Thanks.
Author
Owner

@jmcnamara commented on GitHub (Jun 8, 2019):

I've pushed a fix for this to master where the library tries to bubble up the zip (not zlib) errors.

I simulated some of the failure conditions and the warning/error is now:

[ERROR] workbook_close(): Zip ZIP_BADZIPFILE error while creating xlsx file 'chart.xlsx'. 
This may require the use_zip64 option for large files. 
System error = Undefined error: 0

Can you try it out with your real world test case.

<!-- gh-comment-id:500127365 --> @jmcnamara commented on GitHub (Jun 8, 2019): I've pushed a fix for this to master where the library tries to bubble up the zip (not zlib) errors. I simulated some of the failure conditions and the warning/error is now: ``` [ERROR] workbook_close(): Zip ZIP_BADZIPFILE error while creating xlsx file 'chart.xlsx'. This may require the use_zip64 option for large files. System error = Undefined error: 0 ``` Can you try it out with your real world test case.
Author
Owner

@evanmiller commented on GitHub (Jun 8, 2019):

Works perfectly. Thank you.

<!-- gh-comment-id:500129851 --> @evanmiller commented on GitHub (Jun 8, 2019): Works perfectly. Thank you.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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: github-starred/libxlsxwriter#183
No description provided.