pulumi/pulumi · error

marshaling old outputs for resource error hook %q: %w

Error message

marshaling old outputs for resource error hook %q: %w

What it means

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.

Source

Thrown at pkg/resource/deploy/source_eval.go:1965

			KeepOutputValues: true,
			KeepByteString:   cb.AcceptsByteString,
		}
		if newInputs != nil {
			mNewInputs, err = plugin.MarshalProperties(newInputs, mOpts)
			if err != nil {
				return false, fmt.Errorf("marshaling new inputs for resource error hook %q: %w", name, err)
			}
		}
		if oldInputs != nil {
			mOldInputs, err = plugin.MarshalProperties(oldInputs, mOpts)
			if err != nil {
				return false, fmt.Errorf("marshaling old inputs for resource error hook %q: %w", name, err)
			}
		}
		if oldOutputs != nil {
			mOldOutputs, err = plugin.MarshalProperties(oldOutputs, mOpts)
			if err != nil {
				return false, fmt.Errorf("marshaling old outputs for resource error hook %q: %w", name, err)
			}
		}
		reqBytes, err := proto.Marshal(&pulumirpc.ErrorHookRequest{
			Urn:             string(urn),
			Id:              string(id),
			Name:            name,
			Type:            string(typ),
			NewInputs:       mNewInputs,
			OldInputs:       mOldInputs,
			OldOutputs:      mOldOutputs,
			FailedOperation: failedOperation,
			Errors:          errorMessages,
			OldOptions:      oldOptions,
			NewOptions:      newOptions,
		})
		if err != nil {
			return false, fmt.Errorf("marshaling error hook request for %q: %w", name, err)
		}

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Inspect the wrapped error for the failing property; fix the value in pulumi stack export output and re-import
  2. Run pulumi refresh to reconcile state with the real resource and rewrite outputs
  3. If outputs are unrecoverable, recreate the resource (pulumi destroy/replace for that resource)
  4. Restore the stack from a pre-corruption backup
Defensive patterns

Strategy: validation

Validate before calling

// after pulumi stack export, check outputs of the failing resource for non-standard value shapes before re-import

Try / catch

if err != nil && strings.Contains(err.Error(), "marshaling old outputs for resource error hook") {
    // run pulumi refresh to rebuild outputs from the real cloud resource, then retry
}

Prevention

When it happens

Trigger: plugin.MarshalProperties(oldOutputs, ...) fails while assembling an ErrorHookRequest — the previously recorded outputs of the resource (from state) contain values the marshaller cannot encode.

Common situations: 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.

Related errors


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