pulumi/pulumi · error

stack URN was empty

Error message

stack URN was empty

What it means

This error is thrown when stack registration reports SUCCESS but the response contains an empty URN. The interpreter needs the stack URN to proceed (it stores it in i.stackURN and uses it for later operations), so an empty URN is treated as a protocol violation.

Source

Thrown at pkg/pcl/runtime/interpreter.go:958

	})
	return err
}

func (i *Interpreter) registerStack(ctx context.Context) error {
	stackName := fmt.Sprintf("%s-%s", i.info.Project, i.info.Stack)
	resp, err := i.monitor.RegisterResource(ctx, &pulumirpc.RegisterResourceRequest{
		Type:   string(resource.RootStackType),
		Name:   stackName,
		Custom: false,
	})
	if err != nil {
		return err
	}
	if resp.GetResult() != pulumirpc.Result_SUCCESS {
		return fmt.Errorf("stack registration failed: %s", resp.GetResult())
	}
	if resp.GetUrn() == "" {
		return errors.New("stack URN was empty")
	}
	if resp.Object != nil {
		marshalOpts := plugin.MarshalOptions{
			KeepUnknowns:  true,
			KeepSecrets:   true,
			KeepResources: true,
		}
		objectValue, err := plugin.UnmarshalProperties(resp.Object, marshalOpts)
		if err != nil {
			return fmt.Errorf("unmarshal stack outputs: %w", err)
		}

		err = i.setVariable(ctx, "pulumi", resource.NewProperty(objectValue))
		if err != nil {
			return fmt.Errorf("set pulumi variable: %w", err)
		}
	}
	i.stackURN = resp.GetUrn()

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Upgrade the Pulumi CLI/engine to matching, current versions
  2. Inspect engine logs and state (`pulumi stack export`, .pulumi state) for corruption
  3. Check for bugs in custom engine backends (self-hosted) that skip URN population
  4. File/report an issue if a supported engine consistently returns an empty URN

Example fix

// before
# self-hosted engine returns success with empty URN
// after
$ pulumi version && pulumi plugin ls   # align versions
$ curl -fsSL https://get.pulumi.com | sh  # upgrade engine+CLI, retry
Defensive patterns

Strategy: type-guard

Type guard

func stackURNValid(resp *pulumirpc.RegisterStackResponse) bool {
    return resp.GetResult() == pulumirpc.Result_SUCCESS && resp.GetUrn() != ""
}

Prevention

When it happens

Trigger: RegisterStack-style RPC returns Result_SUCCESS but resp.GetUrn() == "" — the engine acknowledged registration without producing a stack URN.

Common situations: Engine/plugin protocol mismatch (older engine not populating the URN field); engine bug or corrupted deployment state; custom/embedded engine implementations that return success without a URN.

Related errors


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