Tutorial: Debug a Failed Deploy
This tutorial is the shortest disciplined path from "deploy failed" to an actionable root cause.
Start here if: a plan or apply failed and you need to identify whether the problem is configuration, provider access or stored state. Keep the original error and command so subsequent checks can use the same app and backend.
For what to do with partially completed changes, keep the recovery runbook alongside this walkthrough.
Step 1: Confirm Which Execution Path Failed
Ask first:
- was this a legacy stack deploy?
- was this a hybrid app deploy?
Those paths fail for different reasons and expose different artifacts.
Step 2: Reduce The Scope
Identify the smallest failing unit:
- one app
- one stack
- one provider
- one command
Useful commands:
nf list apps
nf list stacks
Step 3: Re-Run With Better Logging
Inspect a fresh plan with more logging before retrying an apply:
nf plan --stack network --log-level DEBUG
Or for hybrid execution:
nf plan --app platform --log-level DEBUG
Step 4: Inspect The Right Boundary
For legacy stacks:
nf synth
nf plan --stack network
nf diff --stack network
Also inspect the generated stack output under .nf.out/.
For hybrid apps:
nf plan --app platform
Focus on provider configuration, backend choice, and runtime errors rather than synthesized JSON alone.
Step 5: Check Backend And State Assumptions
If the failure looks like a state or bootstrap problem:
nf backend show
nf backend validate
For legacy paths, also use:
nf state --stack network list
Step 6: Separate Modeling Problems From Environment Problems
Common buckets are:
- bad selectors or project config
- missing credentials or wrong region/url
- backend resources missing
- model does not match live infrastructure
- provider or generation package not installed
Classify the failure before changing code.
Continue after finding the cause
Correct the smallest identified issue, then review a fresh plan against the same backend. If the failed apply changed objects, inspect its recovery notes and state before deciding whether to continue from partial progress or revert infrastructure. A checkpoint rewrites state only; the recovery procedure explains the ordering and the limits of rollback.