Skip to main content

Build

Pulumi Debug Failed Operation

PulumiOfficialCertified

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.

  • New
  • v1.2.0
  • Reviewed Jul 21
  • No reviews yet

Capabilities

  • Read what failed

    A failed update and a failed preview both record engine events

  • Find the first real error

    One failure produces several messages, and most of them are…

  • Find the cause and where the fix belongs

    An operation can fail with errors from more than one resource, so work…

  • Fix the cause

    If the evidence does not settle the cause, say what you know, what you…

Getting started

Full instructions

Install the skill, then ask your AI tool for the task in plain words. The full SKILL.md below shows what it covers.

Instructions: SKILL.mdv1.2.0

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. The error is in the
diagnostic events, and a policy violation is in the policy events. Using the fields
you settled on above, fetch the events and pull both kinds out.

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

text
pulumi api /api/stacks/{orgName}/{projectName}/{stackName}/update/<version>/events \
  | jq -r '.events[]
      | if .diagnosticEvent then "[\(.diagnosticEvent.severity)] \(.diagnosticEvent.message)"
        elif .policyEvent then "[policy \(.policyEvent.enforcementLevel)] \(.policyEvent.policyPackName)/\(.policyEvent.policyName): \(.policyEvent.message)"
        else empty end' \
  | sed 's/<{%reset%}>//g'

For a failed preview, use the preview path with the preview id and the same jq
filter:

text
pulumi api /api/stacks/{orgName}/{projectName}/{stackName}/preview/<preview-id>/events \
  | jq -r '<same filter as above>' | 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. A policy
violation with enforcement level mandatory fails the operation by itself, often
with no other error. The trailing sed strips terminal color codes that Pulumi
embeds in the text, which otherwise show up as <{%reset%}>.

Also read how the operation was run. The update record has an environment map
(pulumi api /api/stacks/{orgName}/{projectName}/{stackName}/updates/<version>).
A pulumi.flag.target key means the run used --target, and git.head and
git.dirty tell you which commit it ran.

Find the first real error

One failure produces several messages, and most of them are consequences. Before
you trace anything, find the first error that names a resource, a function call, or
a line of the program. Treat these as symptoms of an earlier error, never as the
cause:

  • Resource monitor has terminated, shutting down, grpc: the client connection is closing, Channel has been shut down, Python _InactiveRpcError tracebacks, and
    .NET Grpc.Core.RpcException traces. The engine stopped because something else
    failed first.
  • A Python traceback that ends in KeyboardInterrupt, or context canceled. The
    run was stopped by a person, a CI timeout, or a cancel. Look for an earlier error.
  • expected resource operations for <urn> but none were seen when another error is
    present. An update plan was cut short by that error.
  • Node.js lines about promises that were still waiting (PULUMI_DEBUG_PROMISE_LEAKS),
    deprecation and experimental warnings, and credential-source warnings.
  • update failed and preview failed on their own lines.

If no error remains after you set these aside, the record is too thin. For a run in
CI, the update record's environment map often has ci.build.url; read that log.
For a local run, run the same pulumi preview again with --debug and read its
output. Tell the user what you found and where.

An error from a function call (invocation of aws:route53/getZone:getZone returned an error, invoke of ... failed) has no URN. Trace it to the call in the program
and to the inputs passed to that call. Check that the call ran against the account,
subscription, or project the stack is meant to use.

Find the cause and where the fix belongs

An operation can fail with errors from more than one resource, so work through each
real error. Trace it 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.

Before you edit code, compare this run with the last successful operation of the
same kind on the stack. If the commit is the same and the stack config is the same,
the code is very likely not the problem, and the fix is in the command, the config,
the workspace, the state, or the environment.

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 six places. Name the right one before you
change anything; most wasted fixes edit code that was never the problem.

Search references/common-failures.md for a
distinctive phrase from the first real error, for example
grep -n -i 'not specified in --target' references/common-failures.md, and read
the matching entry. Its contents list names every entry. If nothing matches, use
the six places below.

  • 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. Fix it by editing the
    code. One exception: when the program throws on purpose, because a guard checks
    the branch, account, region, an environment variable, or the state of something
    in the cloud, the guard is working. Satisfy the precondition, or tell the user what
    the guard asks for when only they can do it; never delete the check.
  • The command. The code is correct, but the way it was run is wrong: a
    --target URN that does not match, a resource left out of a --target list, or
    a targeted run after a provider change. Fix the command, not the code.
  • The stack config and other stacks. A required config key is not set for this
    stack, or a StackReference reads an output that the other stack does not export.
    Set the key for this stack, or check what the other stack exports and in which
    code.
  • The workspace. Dependencies are not installed, a local package is not built,
    a build step that makes a file the program reads did not run, or the language
    toolchain is missing or the wrong version. Run pulumi install, build the package
    or the file, or install the toolchain.
  • 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, a wrong cloud account, the key that encrypts the stack's secrets, or a quota.
    Fix the identity, the ESC environment, or the capacity. Change resource code only
    when the account cannot offer the value the program asks for, such as a machine
    size that is not available in the region.

When a resource failed to become ready and the message holds no rejection from the
API, read the error in the system the resource deployed to; see "Resources that do
not become ready" in the reference. 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

If the evidence does not settle the cause, say what you know, what you do not, and
the one check that would settle it. Do not act on a guess.

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.

Ask the user before an action that deletes or replaces a resource, deploys another
stack, deploys to production, or changes permissions. Never remove protect, delete
a resource from state, raise a timeout, or turn off a security control as the fix
unless you have found why that is correct and the user agrees. These changes make
the error go away without fixing its cause, and some of them destroy data.

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.

Explore more skills

Browse all
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

More from Pulumi

View source →
cloudformation-to-pulumiConvert, migrate, or import AWS CloudFormation stacks or templates into Pulumi programs. Load this skill whenever a user wants to move from CloudFormation to Pulumi, convert a CFN template, import existing CloudFormation-managed resources…0 installspackage-usageTrack which stacks across a Pulumi organization use a specific package and at what versions. Use for cross-stack audits, identifying outdated or unmaintained package versions across many stacks, finding affected stacks before publishing…0 installspulumi-deliveryAuthor, register, run, operate, debug and migrate to Pulumi Delivery pipelines (delivery as code), which are Pulumi programs that use the `delivery` package to declare sources, stages, stacks, jobs and approval or manual gates. Use when…0 installsupstream-patchesCreate, amend, remove, and rebase patches for Terraform provider submodules using `./scripts/upstream.sh`. Use when `upgrade-provider` or manual patch work needs owning-patch lookup, patch conflict fixes, patch/hunk removal, or upstream…0 installsprovider-upgradeUpgrade any Pulumi provider to a newer version and reconcile the resulting diff. Use when users want to upgrade or update a provider (including editing package.json, requirements.txt, pyproject.toml, go.mod, or Pulumi.yaml to bump a…0 installspulumi-setup-agent-automationCreate a schedule or event trigger for an existing Pulumi Agent, or pause or resume an automation. Use when the user requests recurring or event-driven agent work, says yes to a proposed schedule or trigger, or asks to pause or resume an…0 installs

Frequently asked questions about pulumi-debug-failed-operation

What does the pulumi-debug-failed-operation skill do?

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. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the pulumi-debug-failed-operation skill?

Run `npx @skills-hub-ai/cli install pulumi-debug-failed-operation` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/pulumi-debug-failed-operation/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does pulumi-debug-failed-operation work with?

pulumi-debug-failed-operation runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the pulumi-debug-failed-operation skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use pulumi-debug-failed-operation after installing it?

In Claude Code, type `/pulumi-debug-failed-operation` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the pulumi-debug-failed-operation skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.

Badge for your README

Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.

Install on Skills Hub badge preview
Markdown
[![Install on Skills Hub](https://skills-hub.ai/api/badges/skill/pulumi-debug-failed-operation)](https://skills-hub.ai/skills/pulumi-debug-failed-operation)
HTML
<a href="https://skills-hub.ai/skills/pulumi-debug-failed-operation"><img src="https://skills-hub.ai/api/badges/skill/pulumi-debug-failed-operation" alt="Install on Skills Hub"></a>

More options in the badge docs.