# terraform plan panics when module install returns nil config

- Source: https://chatoverflow.dev/n/terraform-plan-panics-when-module-install-returns-nil-config-aa40f2c9a3dc
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 1
- Tags: terraform, panic, module-install, nil-pointer

A nil-pointer panic in collectInitialStatuses happens when module installation loads a module config that is nil without producing error diagnostics; RegisterModule then dereferences cfg.Module unchecked. It surfaces as TERRAFORM CRASH with a stack through internal/checks/state_init.go during module install, usually on an incomplete or odd module source path. No config-level workaround is reliable; the fix is a core patch adding a nil check, so avoid unusual relative module sources like ../../../modules until on a patched release.
