pulumi/pulumi · error
marshaling old inputs for resource error hook %q: %w
Error message
marshaling old inputs for resource error hook %q: %w
What it means
Same family as the new-inputs marshal error: when building the ErrorHookRequest, the engine marshals the resource's old (previous) inputs with plugin.MarshalProperties. Failure means the previous inputs stored in state could not be serialized for the hook callback.
Source
Thrown at pkg/resource/deploy/source_eval.go:1959
var mNewInputs, mOldInputs, mOldOutputs *structpb.Struct
mOpts := plugin.MarshalOptions{
Label: fmt.Sprintf("ResourceMonitor.ErrorHook(%s, %s)", name, urn),
KeepUnknowns: true,
KeepSecrets: true,
KeepResources: true,
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,View on GitHub (pinned to 793f7b2e16)
Solutions
- Export the stack (pulumi stack export) and inspect the resource's old inputs for malformed values; fix or remove them and re-import
- Delete and recreate the affected resource if its persisted inputs are irrecoverably corrupt
- Restore the stack from a backup taken before the corruption
- Report/upgrading provider if it is known to emit unserializable values
Example fix
// before $ pulumi stack import --file corrupted.json // after $ pulumi stack export > s.json # fix old inputs offline $ pulumi stack import --file s.json
Defensive patterns
Strategy: validation
Validate before calling
// validate persisted old inputs from an exported stack: stack, _ := json.Marshal(exportedStack) // verify resource inputs contain only scalar/array/object values with valid secret/asset refs
Try / catch
if err != nil && strings.Contains(err.Error(), "marshaling old inputs for resource error hook") {
// export stack, inspect and repair the resource's inputs, then re-import
} Prevention
- Never hand-edit state without validating JSON schema afterwards
- Keep stack backups (pulumi stack export) before upgrades
- Avoid mixing state files across very different Pulumi versions
When it happens
Trigger: plugin.MarshalProperties(oldInputs, ...) fails while assembling an ErrorHookRequest after a failed resource operation — usually due to corrupt or non-serializable values persisted in the stack state from an earlier deployment.
Common situations: Stack state edited by hand (pulumi stack export/import) introducing invalid values; state written by an incompatible older Pulumi version; provider-authored property values with unsupported types.
Related errors
- marshaling old outputs for resource error hook %q: %w
- marshaling old inputs for resource hook %q: %w
- marshaling old outputs for resource hook %q: %w
- marshaling new inputs for resource error hook %q: %w
- resource serialization failed; illegal markup extension: '%v
AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31).
Data as JSON: /api/errors/4f19d66ef6ad3f8b.
Report an issue: GitHub.