Generated banner for Pulumi Debug Failed Operation
Generated logo for Pulumi Debug Failed Operation

Pulumi Debug Failed Operation

PulumiOfficialPublished by Pulumi

  • Skill
  • Review and audit
  • Cloud and DevOps
  • Apache-2.0
  • No issues found

From the author

Debug a Pulumi update or preview that failed: read the failure Pulumi already recorded, find what caused it, and fix it. Load this skill when the user asks to debug, diagnose, or fix a failed update or preview, or points at a failing `pulumi up` or `pulumi preview`. Don't load it for authoring new infrastructure, migrations, or provider upgrades; those have their own skills.
— the description by Pulumi

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a systematic approach to debugging failed Pulumi operations. It guides the user through identifying the specific failed update or preview, retrieving diagnostic events from Pulumi Cloud, and categorizing the root cause into program errors, state drift, or environmental issues. By analyzing the diagnostic logs, the agent helps pinpoint whether the fix requires code changes, state reconciliation, or infrastructure configuration adjustments.

What it does

  • Identifies the specific failed Pulumi update or preview operation.
  • Retrieves and parses diagnostic event logs from Pulumi Cloud.
  • Filters and cleans diagnostic messages to isolate actionable error information.
  • Categorizes failures into program, state, or environment-related issues.
  • Provides a methodology for tracing errors back to specific resources and URNs.
  • Determines the appropriate remediation path based on the nature of the failure.

When to use it

  • When a user reports a failed 'pulumi up' or 'pulumi preview' operation.
  • When you need to investigate the root cause of an infrastructure deployment failure.
  • When diagnostic information is needed from a previous, non-local Pulumi operation.
  • When distinguishing between code-level bugs and external environment or state issues.

Advantages

  • Enables remote debugging of stack operations without requiring local selection.
  • Reduces manual log searching by programmatically extracting diagnostic events.
  • Provides a clear framework for distinguishing between code, state, and environment fixes.
  • Helps avoid unnecessary code changes by identifying state or environment-based root causes.

Usage examples

“My pulumi up failed, can you help me debug it?”
The agent will identify the most recent update, fetch the diagnostic events from the API, and present the errors to help you determine if the issue is in your code, state, or environment.
“Debug update 161 of vvm-dev for me.”
The agent will target the specific update version, retrieve the associated engine events, and analyze the logs to pinpoint the resource causing the failure.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/pulumi/pulumi-debug-failed-operation/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip pulumi-debug-failed-operation.zip -d .agents/skills

Documentation by Pulumi

Debug a failed Pulumi operation

A Pulumi operation has failed. Find what caused it and fix it. The user usually points you at it, so start by working out which operation to debug, and confirm it with the user before doing anything else. Pulumi recorded the error when the operation failed, so once you know which operation it is you can read the error from that record without running anything again.

The commands below reach Pulumi Cloud with pulumi api, a subcommand of the Pulumi CLI that you run in your shell. Each one targets a stack by the explicit {orgName}/{projectName}/{stackName} path you pass it, so you do not need that stack selected locally to read its record. Selecting the stack matters later, when you go to apply a fix.

Start from the operation the user gave you

The user usually supplies the operation as a set of fields: the org, project, stack, and update version (or preview id) — most often stated in prose, for example "debug update 161 of vvm-dev". You need these to address the API: {orgName}, {projectName}, {stackName}, and the version or preview id.

Fill any missing field from context. Take the org, project, or stack from the currently selected stack (pulumi stack --show-name, pulumi stack ls) or Pulumi.yaml. A missing version means the most recent update on that stack.

Briefly confirm which operation you landed on, its version or preview id and the stack, before reading further. Keep it lightweight; they already told you.

Read what failed

A failed update and a failed preview both record engine events, and the error is in the diagnostic messages inside those events. Using the fields you settled on above, fetch the events and pull the messages out.

For a failed update, use the update path with the version number:

pulumi api /api/stacks/{orgName}/{projectName}/{stackName}/update/<version>/events \
  | jq -r '.events[].diagnosticEvent | select(. != null) | "[\(.severity)] \(.message)"' \
  | sed 's/<{%reset%}>//g'

For a failed preview, use the preview path with the preview id:

pulumi api /api/stacks/{orgName}/{projectName}/{stackName}/preview/<preview-id>/events \
  | jq -r '.events[].diagnosticEvent | select(. != null) | "[\(.severity)] \(.message)"' \
  | sed 's/<{%reset%}>//g'

Read every message, not only the ones tagged severity == "error". A provider error carries that error tag, but a program error, which is the common case when a preview fails, arrives as a stderr diagnostic tagged info#err. The trailing sed strips terminal color codes that Pulumi embeds in the text, which otherwise show up as <{%reset%}>.

Find the cause and where the fix belongs

An operation can fail with errors from more than one resource, so read all of the diagnostics first, then work through each error. Trace every error back to the resource that raised it (its URN and type), to where that resource is declared in the program, and to the inputs that feed it.

The error text tells you what kind of problem it is, and that points to where the fix belongs. A Pulumi fix lands in one of three places, and naming the right one keeps you from editing code that was never the problem.

  • The program. The code is wrong: a bad reference, a wrong type, an input the provider rejected, or a value used before it had resolved. This is what a failed preview usually reports, because the plan could not be built. Fix it by editing the code.

  • The state. The code is correct, but the stored state and the real cloud resources disagree. Reconcile drift with pulumi refresh, and bring a resource that already exists outside the state under management with pulumi import rather than recreating it. Note that an operation which failed partway through applying may have already changed some resources, so check the current state before you decide.

  • The environment. The problem is outside Pulumi: credentials, permissions, OIDC, or a quota. Fix the role, the ESC environment, or the capacity that the provider rejected, rather than the resource code.

When a diagnostic is empty or too thin to act on, the real error usually isn't in the record — it's in the log of whatever the resource shelled out to. Read it there. If reaching it needs access you don't have (a token, a run, a not-found), stop and tell the user what you're blocked on and the one thing you need from them.

Fix the cause

Make the smallest change that addresses the root cause. How you confirm the fix, and how you deliver it, whether as a local edit or as a pull request, follow your mode's workflow, not this skill.

If the user didn't say which operation

When the user gives you nothing to go on, debug their most recent operation on the stack. The update list does not record who ran each update, so find it through the API:

  1. Run pulumi whoami to get the current user's login.

  2. Read the latest update and who requested it with pulumi api /api/stacks/{orgName}/{projectName}/{stackName}/updates/latest, and compare its requestedBy.githubLogin to the login from step 1.

  3. If they match, that update is the one to debug. If they do not, walk back one version at a time with pulumi api /api/stacks/{orgName}/{projectName}/{stackName}/updates/<n> until requestedBy.githubLogin matches the user.

Tell the user which operation you landed on, its version, kind, and result, and confirm it is the one they mean before going further.

Files

use_cases.yaml

# Queries that should activate the pulumi-debug-failed-operation skill
queries:
  - "My pulumi up just failed with an error, find the root cause and fix it"
  - "Debug my most recent Pulumi operation on this stack and fix it"
  - "Debug the failed update 5 of this stack and fix it"
  - "pulumi preview is erroring out on this project, help me figure out why and resolve it"
  - "This deployment failed, diagnose what went wrong and fix the issue"
  - "Investigate why my Pulumi update failed and correct it"
  - "Why did update 161 of the vvm-dev stack fail? Fix it"
  - "Debug update 42 on org myorg, project web, stack prod — find the cause"
  - "Update 7 of my staging stack errored, diagnose and fix it"

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
Pulumi
Publisher
Pulumi (Official)
Source
pulumi/agent-skills · pulumi/skills/pulumi-debug-failed-operation · commit 82f222a
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Pulumi.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download pulumi-debug-failed-operation.zip