{"record":{"id":"bd2b599d74fa43c4","repo":"pulumi/pulumi","slug":"joined-error-messages","errorCode":null,"errorMessage":"<joined error messages>","messagePattern":"<joined error messages>","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/pulumi/state/state_protect.go","lineNumber":197,"sourceCode":"func protectMultipleResources(\n\tctx context.Context, stdout io.Writer,\n\tsink diag.Sink, ws pkgWorkspace.Context, stackName string, urns []string, showPrompt bool,\n) error {\n\treturn runTotalStateEditWithPrompt(\n\t\tctx, sink, ws, backend.DefaultLoginManager, stackName, showPrompt, func(_ display.Options, snap *deploy.Snapshot,\n\t\t) error {\n\t\t\tresourceCount, errs := protectResourcesInSnapshot(snap, urns)\n\n\t\t\tif resourceCount > 0 && len(errs) == 0 {\n\t\t\t\tfmt.Fprintf(stdout, \"%d resources protected\\n\", resourceCount)\n\t\t\t}\n\n\t\t\tif len(errs) > 0 {\n\t\t\t\terrMsgs := slice.Prealloc[string](len(errs))\n\t\t\t\tfor _, err := range errs {\n\t\t\t\t\terrMsgs = append(errMsgs, err.Error())\n\t\t\t\t}\n\t\t\t\treturn errors.New(strings.Join(errMsgs, \"\\n\"))\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}, protectMessage)\n}\n","sourceCodeStart":179,"sourceCodeEnd":203,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/pulumi/state/state_protect.go#L179-L203","documentation":"After protecting resources, any per-resource errors collected during the edit are joined with newlines into a single error and surfaced to the user. It aggregates failures like URNs not found in the snapshot.","triggerScenarios":"`pulumi state protect --resource urn1 urn2 ...` where one or more URNs don't match any resource in the snapshot (or other per-resource edit failures occur).","commonSituations":"Typos in URNs; URNs from a different stack; resources deleted or pending deletion and thus excluded; renamed resources with stale URNs.","solutions":["Check each URN against `pulumi stack export` or `pulumi stack --show-urns` and fix typos/mismatches","Ensure the URNs belong to the currently targeted stack","Remember pending-delete resources are skipped — exclude them or refresh state first","Retry after a `pulumi refresh` so URNs reflect current state"],"exampleFix":"// before\n$ pulumi state protect --resource \"urn:pulumi:st::proj::aws:s3/bucket:Bucket::old\"\nerror: ...not found...\n// after\n$ pulumi stack export | grep urn  # find correct URN\n$ pulumi state protect --resource \"urn:pulumi:st::proj::aws:s3/bucket:Bucket::b\"","handlingStrategy":"validation","validationCode":"# verify each URN exists before protecting\npulumi stack export | grep -F \"$URN\" || echo \"missing: $URN\"","typeGuard":null,"tryCatchPattern":"if err != nil {\n    for _, line := range strings.Split(err.Error(), \"\\n\") {\n        log.Printf(\"protect failed: %s\", line)\n    }\n}","preventionTips":["Copy URNs from `pulumi stack export`/`--show-urns`, never from memory","Target the same stack the URNs belong to","Refresh state first; skip pending-delete resources"],"tags":["cli","state-protect","urn"],"backgroundTag":"urn-not-found","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}