Troubleshooting "Decoding resource list failed" errors in Spacelift runs

Last updated: December 19, 2025

The "Decoding resource list failed" error occurs when Spacelift cannot properly decode Terraform plan files. This error can manifest in different ways and has several potential causes.

Common Error Messages

  • Decoding resource list failed: unexpected EOF: decoding plan failed

  • Decoding resource list failed: invalid character '\\' looking for beginning of object key string: decoding plan failed

Root Causes

This error typically occurs due to one of the following issues:

1. Hooks Modifying Plan Output

The most common cause is when post-plan hooks modify or interfere with the plan file generation. These hooks can corrupt the JSON output that Spacelift needs to parse.

2. Provider Version Mismatches

When providers are upgraded (such as AWS provider v6) and there's a version mismatch between what's expected and what's being used.

3. Plan File Format Issues

Compatibility issues with the Terraform plan file format, especially when using tools like Terragrunt or when certain before_init steps interfere with plan generation.

4. OpenTofu Version Upgrades

When upgrading to OpenTofu version 1.10.2+, stricter provider address validation can cause this error.

5. Import Blocks

The error can start occurring after adding Terraform import blocks to configurations.

Troubleshooting Steps

1. Check for Context Hooks

First, identify if you have any contexts attached to your stack that include post-plan hooks. These are the most likely culprit:

  • Review your stack's attached contexts

  • Temporarily disable contexts with post-plan hooks

  • Re-run the stack to see if the error resolves

2. Validate JSON Output Locally

For the "invalid character" variant of this error, test the plan generation locally:

terraform show -json plan.tfplan > plan.json
jq . plan.json

If the local command errors, search for problematic backslashes in your configuration:

grep -R '\\\\' -n .

If it doesn't error locally but fails in Spacelift, the issue is likely due to:

  • A hook modifying the output

  • A provider version mismatch between local and Spacelift environments

3. Review Recent Changes

Consider what changes were made before the error started occurring:

  • Provider version updates

  • Addition of import blocks

  • Changes to before_init or after_init hooks

  • OpenTofu version upgrades

If the issue persists after addressing context hooks, work through the other potential causes systematically, starting with provider version mismatches and configuration changes.