[GH-ISSUE #115] Unhandled error: <class 'RecursionError'>, maximum recursion depth exceeded while calling a Python object #62

Closed
opened 2026-05-06 12:36:56 +02:00 by BreizhHardware · 8 comments

Originally created by @thinkopensource on GitHub (Apr 11, 2024).
Original GitHub issue: https://github.com/patrickchugh/terravision/issues/115

I received this error when execute inside my folder, can I change limit?

Originally created by @thinkopensource on GitHub (Apr 11, 2024). Original GitHub issue: https://github.com/patrickchugh/terravision/issues/115 I received this error when execute inside my folder, can I change limit?
Author
Owner

@patrickchugh commented on GitHub (May 11, 2024):

Thanks for the bug report. Can you confirm if this still exists with the latest release pushed just now?

<!-- gh-comment-id:2106017708 --> @patrickchugh commented on GitHub (May 11, 2024): Thanks for the bug report. Can you confirm if this still exists with the latest release pushed just now?
Author
Owner

@zopz commented on GitHub (May 28, 2024):

I'm having the same issue using main@a9afafd640cc0892834fe6db0aa833fe2cb14e80

Running
Terraform v1.5.7 on darwin_arm64
git version 2.39.3 (Apple Git-146)
dot - graphviz version 11.0.0 (20240428.1522) installed via homebrew

Let me know if there is any more information I can provide!

<!-- gh-comment-id:2136163859 --> @zopz commented on GitHub (May 28, 2024): I'm having the same issue using main@`a9afafd640cc0892834fe6db0aa833fe2cb14e80` Running Terraform v1.5.7 on darwin_arm64 git version 2.39.3 (Apple Git-146) dot - graphviz version 11.0.0 (20240428.1522) installed via homebrew Let me know if there is any more information I can provide!
Author
Owner

@patrickchugh commented on GitHub (May 29, 2024):

@zopz can you share the terraform code so I can try to reproduce?

<!-- gh-comment-id:2136375094 --> @patrickchugh commented on GitHub (May 29, 2024): @zopz can you share the terraform code so I can try to reproduce?
Author
Owner

@zopz commented on GitHub (Jun 3, 2024):

unfortunately this is proprietary code :\

when I have a little more time I'll see if I can reproduce with some similar methods though

<!-- gh-comment-id:2146296590 --> @zopz commented on GitHub (Jun 3, 2024): unfortunately this is proprietary code :\ when I have a little more time I'll see if I can reproduce with some similar methods though
Author
Owner

@c42-arthur commented on GitHub (Jan 13, 2025):

You can reproduce with https://github.com/terraform-aws-modules/terraform-aws-vpc.git?ref=5.7.1 using the following config

azs = ["us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d"]

cidr = "10.100.0.0/16"

private_subnets = ["10.100.64.0/20", "10.100.80.0/20", "10.100.96.0/20", "10.100.112.0/20"]
public_subnets  = ["10.100.128.0/20", "10.100.144.0/20", "10.100.160.0/20", "10.100.176.0/20", "10.100.0.0/20", "10.100.16.0/20", "10.100.32.0/20", "10.100.48.0/20"]

create_database_subnet_group = false
enable_dns_hostnames         = true
enable_dns_support           = true
enable_nat_gateway           = true

enable_vpn_gateway = false

map_public_ip_on_launch = true

propagate_private_route_tables_vgw = false
propagate_public_route_tables_vgw  = false

secondary_cidr_blocks = ["100.64.0.0/24"]

single_nat_gateway = true
<!-- gh-comment-id:2588119679 --> @c42-arthur commented on GitHub (Jan 13, 2025): You can reproduce with https://github.com/terraform-aws-modules/terraform-aws-vpc.git?ref=5.7.1 using the following config ``` azs = ["us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d"] cidr = "10.100.0.0/16" private_subnets = ["10.100.64.0/20", "10.100.80.0/20", "10.100.96.0/20", "10.100.112.0/20"] public_subnets = ["10.100.128.0/20", "10.100.144.0/20", "10.100.160.0/20", "10.100.176.0/20", "10.100.0.0/20", "10.100.16.0/20", "10.100.32.0/20", "10.100.48.0/20"] create_database_subnet_group = false enable_dns_hostnames = true enable_dns_support = true enable_nat_gateway = true enable_vpn_gateway = false map_public_ip_on_launch = true propagate_private_route_tables_vgw = false propagate_public_route_tables_vgw = false secondary_cidr_blocks = ["100.64.0.0/24"] single_nat_gateway = true ```
Author
Owner

@arnm commented on GitHub (Jan 2, 2026):

Confirming this issue still occurs on the latest version (v0.9.1, commit f9f1143).

Environment:

  • terravision: v0.9.1 (f9f1143)
  • Terraform: v1.14.0
  • OS: macOS (darwin_arm64)
  • graphviz: 12.2.1

VPC Module Configuration:
Using terraform-aws-modules/vpc/aws v5.8.1 with 2 AZs, 2 private subnets, and 2 public subnets (similar to @c42-arthur's reproduction case above).

Stack Trace (with --debug):

File ".../interpreter.py", line 477, in find_replace_values
    value = replace_module_vars(modulevar_found_list, value, module, tfdata)
File ".../interpreter.py", line 313, in replace_module_vars
    value = find_replace_values(value, mod, tfdata)
... (repeats until recursion limit)
RecursionError: maximum recursion depth exceeded while calling a Python object

Notes:

  • Issue #127 was closed as fixed, but the underlying mutual recursion between find_replace_values and replace_module_vars still triggers with VPC module configurations
  • The --simplified flag does not help
  • The error occurs after terraform plan completes successfully - it happens during terravision's interpretation phase

Would be happy to help test any proposed fixes.

<!-- gh-comment-id:3706180071 --> @arnm commented on GitHub (Jan 2, 2026): Confirming this issue still occurs on the latest version (v0.9.1, commit `f9f1143`). **Environment:** - terravision: v0.9.1 (`f9f1143`) - Terraform: v1.14.0 - OS: macOS (darwin_arm64) - graphviz: 12.2.1 **VPC Module Configuration:** Using `terraform-aws-modules/vpc/aws` v5.8.1 with 2 AZs, 2 private subnets, and 2 public subnets (similar to @c42-arthur's reproduction case above). **Stack Trace (with `--debug`):** ``` File ".../interpreter.py", line 477, in find_replace_values value = replace_module_vars(modulevar_found_list, value, module, tfdata) File ".../interpreter.py", line 313, in replace_module_vars value = find_replace_values(value, mod, tfdata) ... (repeats until recursion limit) RecursionError: maximum recursion depth exceeded while calling a Python object ``` **Notes:** - Issue #127 was closed as fixed, but the underlying mutual recursion between `find_replace_values` and `replace_module_vars` still triggers with VPC module configurations - The `--simplified` flag does not help - The error occurs after terraform plan completes successfully - it happens during terravision's interpretation phase Would be happy to help test any proposed fixes.
Author
Owner

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

@arnm @zopz @thinkopensource @c42-arthur I used the same VPC module and was unable to reproduce this. In any case, thank you for your patience. I have added new code which will break the infinite loop after 50 tries to resolve a variable. This at least allows you to proceed with diagram generation if the variable is not critical to your diagram. If you can post the WARNING: XXX output from the log I can try to understand what kind of statement the interpreter is unable to resolve.

'git pull' the latest code and let me know

<!-- gh-comment-id:3707268668 --> @patrickchugh commented on GitHub (Jan 3, 2026): @arnm @zopz @thinkopensource @c42-arthur I used the same VPC module and was unable to reproduce this. In any case, thank you for your patience. I have added new code which will break the infinite loop after 50 tries to resolve a variable. This at least allows you to proceed with diagram generation if the variable is not critical to your diagram. If you can post the WARNING: XXX output from the log I can try to understand what kind of statement the interpreter is unable to resolve. 'git pull' the latest code and let me know
Author
Owner

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

closing due to no response @arnm @zopz @thinkopensource @c42-arthur

<!-- gh-comment-id:4256106213 --> @patrickchugh commented on GitHub (Apr 15, 2026): closing due to no response @arnm @zopz @thinkopensource @c42-arthur
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#62
No description provided.