pulumi/pulumi · error

The Pulumi CLI does not support error hooks. Please update t

Error message

The Pulumi CLI does not support error hooks. Please update the Pulumi CLI.

What it means

Error hooks (on_error list in Hooks) require the resource monitor to support RESOURCE_MONITOR_FEATURE_ERROR_HOOKS. Hooks were configured but the connected CLI/monitor lacks the feature, so the SDK raises before registering.

Source

Thrown at sdk/python/lib/pulumi/runtime/resource.py:1433

                # Delete hooks can't be anonymous
                if hook_type in ("before_delete", "after_delete"):
                    raise ValueError(
                        "Delete resource hooks must be ResourceHook instances"
                    )
                if not callable(hook):
                    raise ValueError("Resource hook must be a Callable or ResourceHook")
                name = f"{name_prefix}_{hook_type}_{i}"
                hook = ResourceHook(name, hook)
            # Wait for the hook registration to complete
            await hook._registered
            getattr(proto, hook_type).append(hook.name)

    on_error_hooks_list: list[ErrorHook] = getattr(hooks, "on_error", []) or []
    if on_error_hooks_list:
        if not monitor_supports_feature(
            resource_pb2.RESOURCE_MONITOR_FEATURE_ERROR_HOOKS
        ):
            raise Exception(
                "The Pulumi CLI does not support error hooks. Please update the Pulumi CLI."
            )

        for error_hook in on_error_hooks_list:
            if not isinstance(error_hook, ErrorHook):
                raise ValueError("Error hooks must be ErrorHook instances")
            await error_hook._registered
            proto.on_error.append(error_hook.name)

    return proto


def register_resource_hook(hook: "ResourceHook") -> asyncio.Future[None]:
    async def do_register() -> None:
        callbacks = await _get_callbacks()
        if callbacks is None:
            raise Exception("No callback server registered.")
        return callbacks.register_resource_hook(hook)

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Upgrade the Pulumi CLI to a version supporting error hooks
  2. Remove the on_error hooks until the CLI is updated
  3. Handle errors via standard exception handling in the program instead

Example fix

// before
Hooks(on_error=[ErrorHook("eh", fn)])
// after
# after upgrading pulumi CLI
Hooks(on_error=[ErrorHook("eh", fn)])  # supported
Defensive patterns

Strategy: validation

Validate before calling

# only attach on_error hooks when CLI supports error hooks
hooks_arg = Hooks(on_error=err_hooks) if cli_supports_error_hooks() else None
res = MyResource("n", opts=ResourceOptions(hooks=hooks_arg))

Try / catch

try:
    res = MyResource("n", opts=ResourceOptions(hooks=Hooks(on_error=err_hooks)))
except Exception as e:
    if "error hooks" in str(e):
        print("CLI does not support error hooks; upgrade or use try/except")
    raise

Prevention

When it happens

Trigger: Passing Hooks(on_error=[...]) on a resource while running against a Pulumi CLI without error hook support.

Common situations: Newest SDK APIs with an older engine; CI runners with stale pulumi binaries.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/9d564201a327c954. Report an issue: GitHub.