Skip to content

Add distinct error codes based on failure origin #2592

@enzofrnt

Description

@enzofrnt

What would you like to be added:

A more granular error code system based on the origin of the error.
For example, if an issue occurs due to a problem in the input file provided to Grype, it should result in a different error code than when Grype is unable to reach its upstream server or database.
This differentiation would make it easier to diagnose and handle failures programmatically or during debugging.

Why is this needed:

Currently, when Grype fails, the error output is sometimes vague and the exit code does not reflect the nature of the problem.
By assigning distinct error codes to common failure categories (e.g. network issues, file format issues, configuration errors, etc.), it would become easier to:

  • Build reliable CI/CD pipelines
  • Improve developer experience during integration
  • Quickly identify and fix errors

Additional context:

This feature would be especially useful when Grype is integrated into automated environments or security pipelines, where error handling needs to be robust and clearly distinguishable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions