[GH-ISSUE #184] graphmaker.py: ValueError: list.remove(x): x not in list #109

Closed
opened 2026-05-06 12:37:34 +02:00 by BreizhHardware · 3 comments

Originally created by @so9000 on GitHub (Apr 2, 2026).
Original GitHub issue: https://github.com/patrickchugh/terravision/issues/184

Attempting to run terravision:

docker run --rm -it   -v $(pwd):/project   -e TFENV_TERRAFORM_VERSION=1.11.1   -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID   -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY   -e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN   patrickchugh/terravision draw --source ./ --debug

Results in error

...
   aws_vpc_endpoint_route_table_association.app_s3_endpoint_rt_assoc_a --> aws_route_table.app_private_rt_a
   aws_vpc_endpoint_route_table_association.app_s3_endpoint_rt_assoc_a --> aws_vpc_endpoint.app_s3_endpoint
   aws_vpc_endpoint_route_table_association.app_s3_endpoint_rt_assoc_b --> aws_route_table.app_private_rt_b
   aws_vpc_endpoint_route_table_association.app_s3_endpoint_rt_assoc_b --> aws_vpc_endpoint.app_s3_endpoint
Traceback (most recent call last):
  File "/usr/bin/terravision", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.12/site-packages/terravision/terravision.py", line 527, in main
    cli(
  File "/usr/lib/python3.12/site-packages/click/core.py", line 1485, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 1406, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 1873, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 1269, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 824, in invoke
    return callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/terravision/terravision.py", line 381, in draw
    tfdata = compile_tfdata(
             ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/terravision/terravision.py", line 244, in compile_tfdata
    tfdata = _enrich_graph_data(tfdata, debug, already_processed)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/terravision/terravision.py", line 114, in _enrich_graph_data
    tfdata = graphmaker.create_multiple_resources(tfdata)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/modules/graphmaker.py", line 2236, in create_multiple_resources
    tfdata = handle_count_resources(multi_resources, tfdata)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/modules/graphmaker.py", line 2028, in handle_count_resources
    resource_i = add_number_suffix(i + 1, resource, tfdata)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/modules/graphmaker.py", line 1854, in add_number_suffix
    new_list.remove(resource)
ValueError: list.remove(x): x not in list
Originally created by @so9000 on GitHub (Apr 2, 2026). Original GitHub issue: https://github.com/patrickchugh/terravision/issues/184 Attempting to run terravision: ``` docker run --rm -it -v $(pwd):/project -e TFENV_TERRAFORM_VERSION=1.11.1 -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN patrickchugh/terravision draw --source ./ --debug ``` Results in error ``` ... aws_vpc_endpoint_route_table_association.app_s3_endpoint_rt_assoc_a --> aws_route_table.app_private_rt_a aws_vpc_endpoint_route_table_association.app_s3_endpoint_rt_assoc_a --> aws_vpc_endpoint.app_s3_endpoint aws_vpc_endpoint_route_table_association.app_s3_endpoint_rt_assoc_b --> aws_route_table.app_private_rt_b aws_vpc_endpoint_route_table_association.app_s3_endpoint_rt_assoc_b --> aws_vpc_endpoint.app_s3_endpoint Traceback (most recent call last): File "/usr/bin/terravision", line 8, in <module> sys.exit(main()) ^^^^^^ File "/usr/lib/python3.12/site-packages/terravision/terravision.py", line 527, in main cli( File "/usr/lib/python3.12/site-packages/click/core.py", line 1485, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/click/core.py", line 1406, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/click/core.py", line 1873, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/click/core.py", line 1269, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/click/core.py", line 824, in invoke return callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/terravision/terravision.py", line 381, in draw tfdata = compile_tfdata( ^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/terravision/terravision.py", line 244, in compile_tfdata tfdata = _enrich_graph_data(tfdata, debug, already_processed) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/terravision/terravision.py", line 114, in _enrich_graph_data tfdata = graphmaker.create_multiple_resources(tfdata) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/modules/graphmaker.py", line 2236, in create_multiple_resources tfdata = handle_count_resources(multi_resources, tfdata) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/modules/graphmaker.py", line 2028, in handle_count_resources resource_i = add_number_suffix(i + 1, resource, tfdata) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/modules/graphmaker.py", line 1854, in add_number_suffix new_list.remove(resource) ValueError: list.remove(x): x not in list ```
Author
Owner

@so9000 commented on GitHub (Apr 2, 2026):

tfdata.json

<!-- gh-comment-id:4179935043 --> @so9000 commented on GitHub (Apr 2, 2026): [tfdata.json](https://github.com/user-attachments/files/26447047/tfdata.json)
Author
Owner

@patrickchugh commented on GitHub (Apr 3, 2026):

Thanks for reporting this @so9000 and the tfdata.json you included was extremely helpful as it helped me correct a few other issues I uncovered which were unique to your infrastructure. This has now all been fixed in the latest version and here is the final diagram I was able to produce from your tfdata.

Image
<!-- gh-comment-id:4183854379 --> @patrickchugh commented on GitHub (Apr 3, 2026): Thanks for reporting this @so9000 and the tfdata.json you included was extremely helpful as it helped me correct a few other issues I uncovered which were unique to your infrastructure. This has now all been fixed in the latest version and here is the final diagram I was able to produce from your tfdata. <img width="7606" height="4638" alt="Image" src="https://github.com/user-attachments/assets/081a1cc0-945e-4cf8-80a5-f4fd181e71d1" />
Author
Owner

@so9000 commented on GitHub (Apr 4, 2026):

Nice! It's working for me now, too. Thank you!

<!-- gh-comment-id:4187335312 --> @so9000 commented on GitHub (Apr 4, 2026): Nice! It's working for me now, too. Thank you!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/terravision#109
No description provided.