cdxgen: Unable to extract and archiving Read Error

Discussed in https://github.com/CycloneDX/cdxgen/discussions/1313

<div type='discussions-op-text'>

Originally posted by arkajnag23 August 14, 2024 I am running CDXGEN in Server mode and using API to generate the SBOMs. For some multi-module maven projects which contains Java, JS packages, we are seeing errors , which eventually I feel, preventing to generate SBOM completely.

Falling back to parsing pom.xml files. Only direct dependencies would get included! Multiple errors occurred while building this project with maven. The SBOM is therefore incomplete! Unable to extract /tmp/jar-deps-q95rby/webapp.war. Skipping. Error: Archive read error at FsRead.readUntilFoundCallback [as callback] (/opt/cdxgen/node_modules/.pnpm/node-stream-zip@1.15.0/node_modules/node-stream-zip/node_stream_zip.js:180:46) at FsRead.readCallback (/opt/cdxgen/node_modules/.pnpm/node-stream-zip@1.15.0/node_modules/node-stream-zip/node_stream_zip.js:996:25) at tick (node:fs:653:7) at process.processTicksAndRejections (node:internal/process/task_queues:77:11) Unable to extract /tmp/jar-deps-q95rby/cde-3.3.3.jar. Skipping. Error: Archive read error at FsRead.readUntilFoundCallback [as callback] (/opt/cdxgen/node_modules/.pnpm/node-stream-zip@1.15.0/node_modules/node-stream-zip/node_stream_zip.js:180:46) at FsRead.readCallback (/opt/cdxgen/node_modules/.pnpm/node-stream-zip@1.15.0/node_modules/node-stream-zip/node_stream_zip.js:996:25) at tick (node:fs:653:7) at process.processTicksAndRejections (node:internal/process/task_queues:77:11) Unable to extract /tmp/jar-deps-q95rby/cde-3.2.1.jar. Skipping. Error: Archive read error at FsRead.readUntilFoundCallback [as callback] (/opt/cdxgen/node_modules/.pnpm/node-stream-zip@1.15.0/node_modules/node-stream-zip/node_stream_zip.js:180:46) at FsRead.readCallback (/opt/cdxgen/node_modules/.pnpm/node-stream-zip@1.15.0/node_modules/node-stream-zip/node_stream_zip.js:996:25) at tick (node:fs:653:7) at process.processTicksAndRejections (node:internal/process/task_queues:77:11) Unable to extract /tmp/jar-deps-q95rby/abc-1.2.3.jar. Skipping. Error: Archive read error at FsRead.readUntilFoundCallback [as callback] (/opt/cdxgen/node_modules/.pnpm/node-stream-zip@1.15.0/node_modules/node-stream-zip/node_stream_zip.js:180:46) at FsRead.readCallback (/opt/cdxgen/node_modules/.pnpm/node-stream-zip@1.15.0/node_modules/node-stream-zip/node_stream_zip.js:996:25) at tick (node:fs:653:7) at process.processTicksAndRejections (node:internal/process/task_queues:77:11)

These errors are not providing a lot information. Require help.</div>

About this issue

Most upvoted comments

Thanks @prabhu will do and let you know.

Are you mounting the /tmp directory to the container image using -v /tmp:/tmp? The files must be getting corrupted either during download or during the copy and extract operation. Best to work with a devops person to troubleshoot this further since this is not a cdxgen issue.