{"record":{"id":"646fa35c2feac569","repo":"pulumi/pulumi","slug":"marshaling-inputs-for-resource-q-w","errorCode":null,"errorMessage":"marshaling inputs for resource %q: %w","messagePattern":"marshaling inputs for resource %q: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resource/plugin/converter_server.go","lineNumber":82,"sourceCode":"\t\t}\n\t\tif p := res.Parameterization; p != nil {\n\t\t\tresources[i].Parameterization = &pulumirpc.ResourceParameterization{\n\t\t\t\tPluginName:    p.PluginName,\n\t\t\t\tPluginVersion: p.PluginVersion,\n\t\t\t\tValue:         p.Value,\n\t\t\t}\n\t\t}\n\t\tif e := res.Extension; e != nil {\n\t\t\tresources[i].Extension = &pulumirpc.ResourceExtension{\n\t\t\t\tName:    e.Name,\n\t\t\t\tVersion: e.Version,\n\t\t\t\tValue:   e.Value,\n\t\t\t}\n\t\t}\n\t\tif res.Inputs != nil {\n\t\t\tinputs, err := MarshalProperties(resource.ToResourcePropertyMap(*res.Inputs), MarshalOptions{KeepSecrets: true})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"marshaling inputs for resource %q: %w\", res.Name, err)\n\t\t\t}\n\t\t\tresources[i].Inputs = inputs\n\t\t}\n\t\tif res.Outputs != nil {\n\t\t\toutputs, err := MarshalProperties(resource.ToResourcePropertyMap(*res.Outputs), MarshalOptions{KeepSecrets: true})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"marshaling outputs for resource %q: %w\", res.Name, err)\n\t\t\t}\n\t\t\tresources[i].Outputs = outputs\n\t\t}\n\t}\n\n\t// Translate the hcl.Diagnostics into rpc diagnostics.\n\tdiags := slice.Prealloc[*codegenrpc.Diagnostic](len(resp.Diagnostics))\n\tfor _, diag := range resp.Diagnostics {\n\t\tdiags = append(diags, HclDiagnosticToRPCDiagnostic(diag))\n\t}\n","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/resource/plugin/converter_server.go#L64-L100","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the wrapped (%w) error to identify the offending input property","Upgrade the Pulumi CLI/plugin to matching versions so marshal/unmarshal expectations align","Inspect the resource's inputs in the conversion source and remove or fix exotic values (invalid secret wrapping, nested unsupported types)","If you author a converter plugin, validate PropertyMap contents before returning them"],"exampleFix":"// before\ninputs, err := MarshalProperties(resource.ToResourcePropertyMap(*res.Inputs), MarshalOptions{KeepSecrets: true})\nif err != nil { return nil, fmt.Errorf(\"marshaling inputs for resource %q: %w\", res.Name, err) }\n// after: sanitize before marshal\nsanitized := resource.ToResourcePropertyMap(*res.Inputs)\n// fix or log invalid values in sanitized here\ninputs, err := MarshalProperties(sanitized, MarshalOptions{KeepSecrets: true})\nif err != nil { return nil, fmt.Errorf(\"marshaling inputs for resource %q: %w\", res.Name, err) }","handlingStrategy":"try-catch","validationCode":"// Go: probe-marshal inputs before returning them from a plugin\nif _, err := MarshalProperties(resource.ToResourcePropertyMap(*res.Inputs), MarshalOptions{KeepSecrets: true}); err != nil {\n    return nil, fmt.Errorf(\"resource %q inputs not marshalable: %w\", res.Name, err)\n}","typeGuard":"func isMarshalable(p resource.PropertyMap) bool {\n    _, err := MarshalProperties(p, MarshalOptions{KeepSecrets: true})\n    return err == nil\n}","tryCatchPattern":"inputs, err := MarshalProperties(resource.ToResourcePropertyMap(*res.Inputs), MarshalOptions{KeepSecrets: true})\nif err != nil {\n    return nil, fmt.Errorf(\"marshaling inputs for resource %q: %w\", res.Name, err)\n}","preventionTips":["Only build PropertyMaps from standard PropertyValue constructors","Avoid hand-crafted secret/unknown descriptors in plugin code","Keep plugin SDK and engine versions aligned","Round-trip test (marshal then unmarshal) custom property structures"],"tags":["grpc","serialization","converter"],"backgroundTag":"property-marshal-failed","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}