IndexError: list index out of range
See original GitHub issueDescribe 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:
- 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:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@syphernl / @nimrodkor - Thanks, I’m able to replicate this issue and should have a fix shortly.
@robeden @nimrodkor Thanks for the quick follow-up and fix!