{"record":{"id":"959be632b727220b","repo":"pulumi/pulumi","slug":"marshaling-old-outputs-for-resource-error-hook-q","errorCode":null,"errorMessage":"marshaling old outputs for resource error hook %q: %w","messagePattern":"marshaling old outputs for resource error hook %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resource/deploy/source_eval.go","lineNumber":1965,"sourceCode":"\t\t\tKeepOutputValues: true,\n\t\t\tKeepByteString:   cb.AcceptsByteString,\n\t\t}\n\t\tif newInputs != nil {\n\t\t\tmNewInputs, err = plugin.MarshalProperties(newInputs, mOpts)\n\t\t\tif err != nil {\n\t\t\t\treturn false, fmt.Errorf(\"marshaling new inputs for resource error hook %q: %w\", name, err)\n\t\t\t}\n\t\t}\n\t\tif oldInputs != nil {\n\t\t\tmOldInputs, err = plugin.MarshalProperties(oldInputs, mOpts)\n\t\t\tif err != nil {\n\t\t\t\treturn false, fmt.Errorf(\"marshaling old inputs for resource error hook %q: %w\", name, err)\n\t\t\t}\n\t\t}\n\t\tif oldOutputs != nil {\n\t\t\tmOldOutputs, err = plugin.MarshalProperties(oldOutputs, mOpts)\n\t\t\tif err != nil {\n\t\t\t\treturn false, fmt.Errorf(\"marshaling old outputs for resource error hook %q: %w\", name, err)\n\t\t\t}\n\t\t}\n\t\treqBytes, err := proto.Marshal(&pulumirpc.ErrorHookRequest{\n\t\t\tUrn:             string(urn),\n\t\t\tId:              string(id),\n\t\t\tName:            name,\n\t\t\tType:            string(typ),\n\t\t\tNewInputs:       mNewInputs,\n\t\t\tOldInputs:       mOldInputs,\n\t\t\tOldOutputs:      mOldOutputs,\n\t\t\tFailedOperation: failedOperation,\n\t\t\tErrors:          errorMessages,\n\t\t\tOldOptions:      oldOptions,\n\t\t\tNewOptions:      newOptions,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"marshaling error hook request for %q: %w\", name, err)\n\t\t}","sourceCodeStart":1947,"sourceCodeEnd":1983,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/resource/deploy/source_eval.go#L1947-L1983","documentation":"When building the ErrorHookRequest for a failed resource operation, the engine marshals the resource's old outputs with plugin.MarshalProperties. This error wraps that serialization failure, preventing the error hook from being invoked.","triggerScenarios":"plugin.MarshalProperties(oldOutputs, ...) fails while assembling an ErrorHookRequest — the previously recorded outputs of the resource (from state) contain values the marshaller cannot encode.","commonSituations":"Corrupt persisted outputs in stack state (manual edits, version incompatibility); outputs containing assets/secrets with broken references after state migration; provider that emitted unsupported output value kinds.","solutions":["Inspect the wrapped error for the failing property; fix the value in pulumi stack export output and re-import","Run pulumi refresh to reconcile state with the real resource and rewrite outputs","If outputs are unrecoverable, recreate the resource (pulumi destroy/replace for that resource)","Restore the stack from a pre-corruption backup"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// after pulumi stack export, check outputs of the failing resource for non-standard value shapes before re-import","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"marshaling old outputs for resource error hook\") {\n    // run pulumi refresh to rebuild outputs from the real cloud resource, then retry\n}","preventionTips":["Run pulumi refresh when provider versions change","Keep periodic pulumi stack export backups","Avoid state migrations across incompatible versions without backups"],"tags":["serialization","hooks","state","properties"],"backgroundTag":"property-marshal-failed","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}