checkov-action icon indicating copy to clipboard operation
checkov-action copied to clipboard

AttributeError: 'list' object has no attribute 'items'

Open SriChaturya opened this issue 11 months ago • 1 comments

checkov -d . --soft-fail --output cli --output sarif --output-file-path console,results.sarif
Error: -23 11:56:36,556 [MainThread ] [ERROR] Failed to invoke function /usr/local/lib/python3.11/site-packages/checkov/common/runners/runner_registry._parallel_run with (<checkov.terraform_json.runner.TerraformJsonRunner object at 0x7fcb234d7510>, '.', None, None, <checkov.runner_filter.RunnerFilter object at 0x7fcb234f3dd0>, True, None) Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/checkov/common/parallelizer/parallel_runner.py", line 78, in func_wrapper result = original_func(*item) ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/checkov/common/runners/runner_registry.py", line 836, in _parallel_run report = runner.run( ^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/checkov/terraform_json/runner.py", line 87, in run self.definitions, self.definitions_raw, parsing_errors = create_definitions(file_paths) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/checkov/terraform_json/utils.py", line 59, in create_definitions template, file_lines = parse(file_path) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/checkov/terraform_json/parser.py", line 32, in parse template, template_lines = loads(file_path=file_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/checkov/terraform_json/parser.py", line 77, in loads template = prepare_definition(template) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/checkov/terraform_json/parser.py", line 89, in prepare_definition definition_new[block_type] = handle_block_type(block_type=block_type, blocks=blocks) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/checkov/terraform_json/parser.py", line 97, in handle_block_type for block_name, config in blocks.items(): ^^^^^^^^^^^^ AttributeError: 'list' object has no attribute 'items' Error: -23 11:57:26,486 [MainThread ] [ERROR] Exception traceback: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/checkov/main.py", line 532, in run self.scan_reports = runner_registry.run( ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/checkov/common/runners/runner_registry.py", line 177, in run for result in parallel_runner_results: File "/usr/local/lib/python3.11/site-packages/checkov/common/parallelizer/parallel_runner.py", line 110, in _run_function_multiprocess_fork raise v.internal_exception.with_traceback(v.internal_exception.traceback) AttributeError: 'list' object has no attribute 'items'

Issue started after this commit https://github.com/bridgecrewio/checkov-action/commit/5c5ef32fa4ed5765cb8f4894203edd314f284f61

SriChaturya avatar Jan 23 '25 20:01 SriChaturya

I have roughly the same issue :

checkov -d . --output sarif --framework all Error: -11 13:16:54,265 [MainThread ] [ERROR] Failed to invoke function /usr/local/lib/python3.11/site-packages/checkov/common/runners/runner_registry._parallel_run with (<checkov.serverless.runner.Runner object at 0x7f032c507350>, '.', None, None, <checkov.runner_filter.RunnerFilter object at 0x7f032c533bd0>, True, None) Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/checkov/common/parallelizer/parallel_runner.py", line 78, in func_wrapper result = original_func(*item) ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/checkov/common/runners/runner_registry.py", line 836, in _parallel_run report = runner.run( ^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/checkov/serverless/runner.py", line 116, in run self.context = build_definitions_context(definitions=self.definitions, definitions_raw=self.definitions_raw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/checkov/serverless/graph_builder/definition_context.py", line [22](https://github.com/Ynpact/ynpact-ott-publisher/actions/runs/14404027504/job/40396036118#step:4:23), in build_definitions_context add_resource_to_definitions_context(definitions_context, resource_key, resource_attributes, File "/usr/local/lib/python3.11/site-packages/checkov/serverless/graph_builder/definition_context.py", line 43, in add_resource_to_definitions_context start_line = resource_attributes[START_LINE] - 1 ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^ KeyError: '__startline__' Error: -11 13:16:56,548 [MainThread ] [ERROR] Exception traceback: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/checkov/main.py", line 532, in run self.scan_reports = runner_registry.run( ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/checkov/common/runners/runner_registry.py", line 177, in run for result in parallel_runner_results: File "/usr/local/lib/python3.11/site-packages/checkov/common/parallelizer/parallel_runner.py", line 110, in _run_function_multiprocess_fork raise v.internal_exception.with_traceback(v.internal_exception.__traceback__) KeyError: '__startline__'

running it as a github actioin this way : - name: Test with Checkov id: checkov uses: bridgecrewio/checkov-action@master with: directory: . framework: all

We'll be glad if this could be fixed! I'm also happy to provide more contextual info or perform any if it could help.

alexandre-walzberg avatar Apr 11 '25 13:04 alexandre-walzberg