Repository navigation
Description
Describe the bug
In some cases it appears that the populated_purldb pipeline on a project that previously did load_sbom fails.
Invalid purl: type is a required argument.
Traceback:
File "/opt/scancodeio/aboutcode/pipeline/__init__.py", line 199, in execute
step(self)
File "/opt/scancodeio/scanpipe/pipelines/populate_purldb.py", line 48, in populate_purldb_with_discovered_dependencies
purldb.populate_purldb_with_discovered_dependencies(
File "/opt/scancodeio/scanpipe/pipes/purldb.py", line 369, in populate_purldb_with_discovered_dependencies
packages = [{"purl": purl} for purl in get_unique_resolved_purls(project)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/scancodeio/scanpipe/pipes/purldb.py", line 298, in get_unique_resolved_purls
return {str(PackageURL(*values)) for values in distinct_combinations}
^^^^^^^^^^^^^^^^^^^
File "/opt/scancodeio/.venv/lib/python3.12/site-packages/packageurl/__init__.py", line 369, in __new__
raise ValueError(f"Invalid purl: {key} is a required argument.")
The PURLs in the SBOM look like this: pkg:pypi/beautifulsoup4@4.13.3
System configuration
- Which version of ScanCode.io are you running?
- 34.9.5 + custom patch for RQ worker
- Are you running the app using Docker?
- No; custom helm charts running on Kubernetes
- On which OS?
- Linux
- What inputs are you using?
- An SBOM containing python packages generated with cdxgen
- Which pipeline are you running?
load_sbompopulate_purldb
To Reproduce
Update 2025-03-26:
- It appears that any SBOM that results in dependencies being identified by
load_sbomwill trigger this error - Package URL and type columns are not populated in the table shown by ScanCode.io (see screenshot) which may indicate that the internal model is not properly populated or
populate_purldbis access the wrong fields
Original:
Not quite clear what the cause is. We are using an SBOM containing pypi packages that trigger the exception after the following steps:
- Use Load Packages from SBOM in DejaCode. It will create a project and pipeline in ScanCode.io
- Once the packages have been imported into DejaCode, manually add the pipeline
populate_purldb
- The intention was to make PurlDB gather information on all identified packages
- Instead of a success the job fails within seconds due to the error above
Expected behavior
The expected behavior is that populate_purldb works with regular PURLs found in SBOMs, may this be pypi or other packages managers.
Ideally this would also be run by default if PurlDB is configured, since otherwise this requires manual intervention when these pipelines get triggered from DejaCode. If the SBOM contains no download URL just the PURL, then it is essential that the PurlDB is being populated so that Improve Packages from PurlDB has data to work with

Activity
rogu-beta commentedon Mar 25, 2025
It would greatly help to know what kind of input data causes this issue and if there is a work around.
mjherzog commentedon Mar 25, 2025
@ghsa-retrieval We also need to accommodate the use case where someone is using ScanCode.io without PURLDB.
rogu-beta commentedon Mar 25, 2025
@mjherzog of course, but if ScanCode.io is configured to use PurlDB it would seem sensible to avoid roundtrips and manual intervention. See the following discussion of steps that we currently have to perform, if
populate_purldbworks correctly: aboutcode-org/dejacode#289However, that in itself is unrelated to the exception and the root cause of this issue.
[-]Exception when running populate_purldb on project where previous run was `load_sbom`[/-][+]Exception when running `populate_purldb` on project where previous run was `load_sbom`[/+]rogu-beta commentedon Mar 26, 2025
It appears this issue happens whenever there are not just packages but also dependencies identified during a
load_sbompipeline. The reason appears to be that package type and package url fields in the the internal representation are not populated or thepopulate_purldbpipeline accesses the wrong ones. I've noticed when clicking on the dependencies in ScanCode.io the first columns are not populated.rogu-beta commentedon Mar 26, 2025
I can confirm that emptying the
dependencieslist in a CycloneDX SBOM results in only the packages being listed in ScanCode.io, no dependencies, and subsequently thepopulate_purldbpipeline works successfully (mostly). However, I've noticed that some PURLs are apparently not supported. A project with npm PURLs works without issue with the adapted SBOM, but it refuses to process PURLs to pypi.Python project
When using
populate_purldbafter runningload_sbomon a modified SBOM with an emptydependencieslist:NPM project
When using
populate_purldbafter runningload_sbomon a modified SBOM with an emptydependencieslist:Edit: The issue with pypi packages appears to be coming from purldb and not in ScanCode.io. This can be ignored for this issue. See aboutcode-org/purldb#599