question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IndexError: list index out of range

See original GitHub issue

Describe the bug With the recent version of the Checkov container I’ve been seeing an IndexError: list index out of range error popping up for a bunch of our environments.

$ checkov -d . -o junitxml | tee checkov-report.xml
Traceback (most recent call last):
  File "/usr/local/bin/checkov", line 5, in <module>
    run()
  File "/usr/local/lib/python3.8/site-packages/checkov/main.py", line 86, in run
    scan_reports = runner_registry.run(root_folder=root_folder, external_checks_dir=external_checks_dir,
  File "/usr/local/lib/python3.8/site-packages/checkov/common/runners/runner_registry.py", line 34, in run
    scan_report = runner.run(root_folder, external_checks_dir=external_checks_dir, files=files,
  File "/usr/local/lib/python3.8/site-packages/checkov/terraform/runner.py", line 59, in run
    self.parser.parse_directory(directory=root_folder,
  File "/usr/local/lib/python3.8/site-packages/checkov/terraform/parser.py", line 76, in parse_directory
    self._parse_directory(dir_filter=lambda d: self._check_process_dir(d))
  File "/usr/local/lib/python3.8/site-packages/checkov/terraform/parser.py", line 116, in _parse_directory
    self._internal_dir_load(sub_dir, module_loader_registry, dir_filter)
  File "/usr/local/lib/python3.8/site-packages/checkov/terraform/parser.py", line 214, in _internal_dir_load
    var_value_and_file_map.update({k: (v[0], hcl_tfvars.path) for k, v in data.items()})
  File "/usr/local/lib/python3.8/site-packages/checkov/terraform/parser.py", line 214, in <dictcomp>
    var_value_and_file_map.update({k: (v[0], hcl_tfvars.path) for k, v in data.items()})
IndexError: list index out of range

Details:

Using docker image sha256:0baa68af8354cdb0bf84f81c2217e450c771c47f2310d1b5dccf4406a16a9aef for bridgecrew/checkov:latest with digest bridgecrew/checkov@sha256:c899c4b104a529825bd3dff9f2057501870700d90ec35231864967fecd030e7f ...

It worked fine yesterday with this container:

Using docker image sha256:8e019fbd936fee00ec424f67d976a0b6b982563fc46fb528472b84f3c71fd748 for bridgecrew/checkov:latest with digest bridgecrew/checkov@sha256:9c63f061c767048feea77b0e693d7597bd6ae377b28dc9da157cef7e9395fbf9 ...

To Reproduce Steps to reproduce the behavior:

  1. Run checkov -d . -o junitxml | tee checkov-report.xml in the Terraform folder

Expected behavior No errors, XML output of the report.

Screenshots N/a

Desktop (please complete the following information):

  • OS: Docker container bridgecrew/checkov:latest
  • Checkov Version [e.g. 22] 1.0.779

Additional context Seems to be happening since the changes of https://github.com/bridgecrewio/checkov/pull/867

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
robedencommented, Feb 16, 2021

@syphernl / @nimrodkor - Thanks, I’m able to replicate this issue and should have a fix shortly.

0reactions
syphernlcommented, Feb 16, 2021

@robeden @nimrodkor Thanks for the quick follow-up and fix!

Read more comments on GitHub >

github_iconTop Results From Across the Web

List Index Out of Range – Python Error Message Solved
You'll get the Indexerror: list index out of range error when iterating through a list and trying to access an item that doesn't...
Read more >
Python IndexError: List Index Out of Range Error Explained
We can break down the text a little bit. We can see here that the message tells us that the index is out...
Read more >
Python IndexError: List Index Out of Range [Easy Fix] - Finxter
The error “list index out of range” arises if you access invalid indices in your ...
Read more >
Indexerror: list Index Out of Range in Python - STechies
“List index out of range” error occurs in Python when we try to access an undefined element from the list. The only way...
Read more >
Index Error: list index out of range (Python) - Stack Overflow
Generally it means that you are providing an index for which a list element does not exist. E.g, if your list was [1,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found