{"record":{"id":"beff6c79a802a62b","repo":"pulumi/pulumi","slug":"stack-urn-was-empty","errorCode":null,"errorMessage":"stack URN was empty","messagePattern":"stack URN was empty","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/pcl/runtime/interpreter.go","lineNumber":958,"sourceCode":"\t})\n\treturn err\n}\n\nfunc (i *Interpreter) registerStack(ctx context.Context) error {\n\tstackName := fmt.Sprintf(\"%s-%s\", i.info.Project, i.info.Stack)\n\tresp, err := i.monitor.RegisterResource(ctx, &pulumirpc.RegisterResourceRequest{\n\t\tType:   string(resource.RootStackType),\n\t\tName:   stackName,\n\t\tCustom: false,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tif resp.GetResult() != pulumirpc.Result_SUCCESS {\n\t\treturn fmt.Errorf(\"stack registration failed: %s\", resp.GetResult())\n\t}\n\tif resp.GetUrn() == \"\" {\n\t\treturn errors.New(\"stack URN was empty\")\n\t}\n\tif resp.Object != nil {\n\t\tmarshalOpts := plugin.MarshalOptions{\n\t\t\tKeepUnknowns:  true,\n\t\t\tKeepSecrets:   true,\n\t\t\tKeepResources: true,\n\t\t}\n\t\tobjectValue, err := plugin.UnmarshalProperties(resp.Object, marshalOpts)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshal stack outputs: %w\", err)\n\t\t}\n\n\t\terr = i.setVariable(ctx, \"pulumi\", resource.NewProperty(objectValue))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"set pulumi variable: %w\", err)\n\t\t}\n\t}\n\ti.stackURN = resp.GetUrn()","sourceCodeStart":940,"sourceCodeEnd":976,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/pcl/runtime/interpreter.go#L940-L976","documentation":"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.","triggerScenarios":"RegisterStack-style RPC returns Result_SUCCESS but resp.GetUrn() == \"\" — the engine acknowledged registration without producing a stack URN.","commonSituations":"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.","solutions":["Upgrade the Pulumi CLI/engine to matching, current versions","Inspect engine logs and state (`pulumi stack export`, .pulumi state) for corruption","Check for bugs in custom engine backends (self-hosted) that skip URN population","File/report an issue if a supported engine consistently returns an empty URN"],"exampleFix":"// before\n# self-hosted engine returns success with empty URN\n// after\n$ pulumi version && pulumi plugin ls   # align versions\n$ curl -fsSL https://get.pulumi.com | sh  # upgrade engine+CLI, retry","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func stackURNValid(resp *pulumirpc.RegisterStackResponse) bool {\n    return resp.GetResult() == pulumirpc.Result_SUCCESS && resp.GetUrn() != \"\"\n}","tryCatchPattern":null,"preventionTips":["Keep engine and CLI versions in sync","Validate custom/self-hosted engines return full responses","Monitor for protocol regressions after upgrades"],"tags":["pcl","stack","urn","protocol"],"backgroundTag":"empty-stack-urn","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}