pulumi/pulumi · error

marshaling inputs for resource %q: %w

Error message

marshaling inputs for resource %q: %w

What it means

Thrown by the converter gRPC server when marshaling a resource's Inputs property map into protobuf Struct values for the RPC response fails. MarshalProperties fails on properties that cannot be represented on the wire (e.g. invalid secret/signature structure or unsupported value types). The resource name is included to localize the failure.

Source

Thrown at pkg/resource/plugin/converter_server.go:82

		}
		if p := res.Parameterization; p != nil {
			resources[i].Parameterization = &pulumirpc.ResourceParameterization{
				PluginName:    p.PluginName,
				PluginVersion: p.PluginVersion,
				Value:         p.Value,
			}
		}
		if e := res.Extension; e != nil {
			resources[i].Extension = &pulumirpc.ResourceExtension{
				Name:    e.Name,
				Version: e.Version,
				Value:   e.Value,
			}
		}
		if res.Inputs != nil {
			inputs, err := MarshalProperties(resource.ToResourcePropertyMap(*res.Inputs), MarshalOptions{KeepSecrets: true})
			if err != nil {
				return nil, fmt.Errorf("marshaling inputs for resource %q: %w", res.Name, err)
			}
			resources[i].Inputs = inputs
		}
		if res.Outputs != nil {
			outputs, err := MarshalProperties(resource.ToResourcePropertyMap(*res.Outputs), MarshalOptions{KeepSecrets: true})
			if err != nil {
				return nil, fmt.Errorf("marshaling outputs for resource %q: %w", res.Name, err)
			}
			resources[i].Outputs = outputs
		}
	}

	// Translate the hcl.Diagnostics into rpc diagnostics.
	diags := slice.Prealloc[*codegenrpc.Diagnostic](len(resp.Diagnostics))
	for _, diag := range resp.Diagnostics {
		diags = append(diags, HclDiagnosticToRPCDiagnostic(diag))
	}

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Read the wrapped (%w) error to identify the offending input property
  2. Upgrade the Pulumi CLI/plugin to matching versions so marshal/unmarshal expectations align
  3. Inspect the resource's inputs in the conversion source and remove or fix exotic values (invalid secret wrapping, nested unsupported types)
  4. If you author a converter plugin, validate PropertyMap contents before returning them

Example fix

// before
inputs, err := MarshalProperties(resource.ToResourcePropertyMap(*res.Inputs), MarshalOptions{KeepSecrets: true})
if err != nil { return nil, fmt.Errorf("marshaling inputs for resource %q: %w", res.Name, err) }
// after: sanitize before marshal
sanitized := resource.ToResourcePropertyMap(*res.Inputs)
// fix or log invalid values in sanitized here
inputs, err := MarshalProperties(sanitized, MarshalOptions{KeepSecrets: true})
if err != nil { return nil, fmt.Errorf("marshaling inputs for resource %q: %w", res.Name, err) }
Defensive patterns

Strategy: try-catch

Validate before calling

// Go: probe-marshal inputs before returning them from a plugin
if _, err := MarshalProperties(resource.ToResourcePropertyMap(*res.Inputs), MarshalOptions{KeepSecrets: true}); err != nil {
    return nil, fmt.Errorf("resource %q inputs not marshalable: %w", res.Name, err)
}

Type guard

func isMarshalable(p resource.PropertyMap) bool {
    _, err := MarshalProperties(p, MarshalOptions{KeepSecrets: true})
    return err == nil
}

Try / catch

inputs, err := MarshalProperties(resource.ToResourcePropertyMap(*res.Inputs), MarshalOptions{KeepSecrets: true})
if err != nil {
    return nil, fmt.Errorf("marshaling inputs for resource %q: %w", res.Name, err)
}

Prevention

When it happens

Trigger: The converter server handles a conversion request and a resource's Inputs map (res.Inputs != nil) contains a value MarshalProperties cannot encode into the protobuf property representation.

Common situations: Custom plugin code building converter results with unusual property values (cyclic or non-encodable structures); version mismatch between the plugin API and the engine; hand-constructed PropertyMaps with invalid secret descriptors.

Related errors


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