Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR failed to catalog: unable to decode sbom: sbom format not recognized #2557

Open
abuhurraira opened this issue Mar 23, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@abuhurraira
Copy link

abuhurraira commented Mar 23, 2025

What happened:

When I run Grype to scan my SBOM file generated by Syft, I consistently receive the following error:

ERROR failed to catalog: unable to decode sbom: sbom format not recognized

I have attempted to generate the SBOM in multiple formats—including SPDX JSON, CycloneDX JSON, and plain JSON—but Grype fails to recognize any of these formats. I have validated the generated SBOM files using online validators for SPDX and CycloneDX, and they appear to be correctly structured.

What you expected to happen:

I expected Grype to successfully parse and catalog the SBOM file, identifying the list of packages and dependencies so that it can scan them for vulnerabilities.

Generate the SBOM using Syft:

For SPDX JSON format:

syft dir:. -o spdx-json > sbom.jso
For CycloneDX JSON format:

syft dir:. -o cyclonedx-json > sbom.json
For plain JSON format:

syft dir:. -o json > sbom.json
Run Grype on the SBOM file:

grype sbom:./sbom.json

Grype Version: 0.90.0
Syft Version: 1.21.0

Operating System: Windows 11 / Powershell PsVersion: 5.1.22621.4391

@abuhurraira abuhurraira added the bug Something isn't working label Mar 23, 2025
@spiffcs
Copy link
Contributor

spiffcs commented Mar 26, 2025

Thanks @abuhurraira for the bug report:

ERROR failed to catalog: unable to decode sbom: sbom format not recognized

What do the contents of the file look like for each SBOM file?
If the contents look valid on a cursory glance could you try something like this for a sanity check:

syft -o json alpine:latest > test.json
grype test.json

I want to try and track down if it's an issue with the tools themselves on windows or if the directory being scanned is producing some kind of error that syft cannot get through.

@abuhurraira
Copy link
Author

sbom.cdx.json This is the file in CycloneDx format. Please check and let me know if there's an issue with the file.

@kzantow
Copy link
Contributor

kzantow commented Mar 31, 2025

Hey @abuhurraira, I downloaded and tried the SBOM you provided, and I do not receive the error you mentioned. Is there an issue with file encodings when using file redirection > sbom... in PowerShell?

Could you try to output the file directly, using -o <format>=<file-path>, e.g.

syft dir:. -o json=sbom.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

3 participants