Problem
When performing a run in Terraform Enterprise, you may encounter the following error message, which prevents the plan from being displayed in the UI.
Error fetching plan data: Cannot read properties of null (reading 'length')
Cause
This is a known issue that affects Terraform Enterprise (TFE) versions prior to v202210-1. The error occurs when the UI's Structured Run Output view attempts to compare a JSON-encoded array with a null value during the plan phase.
Solutions
There are two approaches to resolve this issue.
Solution 1: Change the Workspace UI Setting
You can work around the issue by changing the user interface setting for the affected workspace to avoid the structured output view.
- Navigate to the affected workspace in your Terraform Enterprise instance.
- Go to Settings > General.
- Under the User Interface section, select Console UI.
- Click Save settings.
This change bypasses the component that triggers the error.
Solution 2: Upgrade Terraform Enterprise
The permanent solution is to upgrade your Terraform Enterprise instance to version v202210-1 (build 659) or a later version. This release contains the fix for this issue.
Outcome
After applying one of these solutions, you can retry the failed run. The operation should now complete without this error.