Skip to content

Implement exit code on internal errors #7393

@pszypowicz

Description

@pszypowicz

Describe the feature

When Checkov fails with an internal error, there is no distinction on exit codes.

Examples

Like for example I got the internal error, but due to --soft-fail I am not able to easily detect it and react to it.

2025-12-03 12:47:38,346 [MainThread  ] [WARNI]  Failed to get the checkov mappings and guidelines from https://api0.prismacloud.io/bridgecrew/api/v2/guidelines. Skips using BC_* IDs will not work.
Traceback (most recent call last):
  File "/home/vsts/.cache/uv/archive-v0/JZlzYn8xAyzQIZXHAN70s/lib/python3.12/site-packages/checkov/common/bridgecrew/platform_integration.py", line 1281, in get_public_run_config
    self.public_metadata_response = json.loads(request.data.decode("utf8"))
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

       _               _
   ___| |__   ___  ___| | _______   __
  / __| '_ \ / _ \/ __| |/ / _ \ \ / /
 | (__| | | |  __/ (__|   < (_) \ V /
  \___|_| |_|\___|\___|_|\_\___/ \_/

By Prisma Cloud | version: 3.2.495 

Additional context

This is neccessary to make a proper pipeline logic, halt or rerun script on internal error, ignore if the checkov is running with a "soft-fail" flag.

Probably a duplicate of #3619 but it got closed and have no responses there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contribution requestedThis is a great feature idea, but we will need a contribution to get it added to Checkov.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions