Skip to content

[Bug] scan and generate write a BOM file for models that are not found on Hugging Face #21

@wiebe-vandendriessche

Description

@wiebe-vandendriessche

AIBoMGen CLI version

v0.2.1

Go version (if built from source)

go1.25.x

Operating system

Any

Command used

aibomgen-cli generate --model-id org/nonexistent-model --output ./dist/out.json

Expected behavior

No BOM file is created for a model that returns 404 from the Hugging Face API. The CLI reports the model as not found and exits without writing any output file.

Actual behavior

A BOM file is created and written to the output path with only the minimal skeleton (component name from the scanner discovery, no HF metadata, no license, no tags). In BuildPerDiscovery and BuildFromModelIDs, when fetchers.modelAPI.Fetch(modelID) returns a 404 error, an EventError is fired but resp is set to nil and execution continues to bomBuilder.Build(bctx) with HF: nil. The BOM is built from the nil API response and appended to results, then written to disk by WriteOutputFiles.

Additional context

The UI correctly tracks t.notFound = true via the progress callback and shows the model as "not found" in the summary, but the empty BOM file is still written before the summary is printed. Fix: skip models where the API fetch returned IsNotFound(err) before calling bomBuilder.Build. A model that could not be found on HF should produce no output file.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions