{"record":{"id":"b2088f2f1b9878e7","repo":"pulumi/pulumi","slug":"unmarshaling-self-w","errorCode":null,"errorMessage":"unmarshaling __self__: %w","messagePattern":"unmarshaling __self__: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/go/pulumi/provider.go","lineNumber":975,"sourceCode":"\treturn self, nil\n}\n\n// callArgsSelf retrieves the `__self__` argument. If `__self__` is present the value is returned,\n// otherwise the returned value will be nil.\nfunc callArgsSelf(ctx *Context, source map[string]any) (Resource, error) {\n\tv, ok := source[\"__self__\"]\n\tif !ok {\n\t\treturn nil, nil\n\t}\n\n\tci := v.(*constructInput)\n\tif ci.value.ContainsUnknowns() {\n\t\treturn nil, errors.New(\"__self__ is unknown\")\n\t}\n\n\tvalue, secret, err := unmarshalPropertyValue(ctx, ci.value)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unmarshaling __self__: %w\", err)\n\t}\n\tif secret {\n\t\treturn nil, errors.New(\"__self__ is a secret\")\n\t}\n\n\treturn value.(Resource), nil\n}\n\n// newCallResult converts a result struct into an input Map that can be marshalled.\nfunc newCallResult(result any) (Input, error) {\n\tif result == nil {\n\t\treturn nil, errors.New(\"result must not be nil\")\n\t}\n\n\tresultV := reflect.ValueOf(result)\n\ttyp := resultV.Type()\n\tif typ.Kind() != reflect.Pointer || typ.Elem().Kind() != reflect.Struct {\n\t\treturn nil, errors.New(\"result must be a pointer to a struct\")","sourceCodeStart":957,"sourceCodeEnd":993,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/go/pulumi/provider.go#L957-L993","documentation":"callArgsSelf wraps any failure from unmarshalPropertyValue while decoding the `__self__` resource argument as \"unmarshaling __self__: %w\". It means the raw gRPC value sent for the resource receiver could not be converted back into a Go Resource (malformed property map, missing required fields like __self__'s URN/type, or an unsupported value inside it).","triggerScenarios":"A method-style Call whose `__self__` serialized value cannot round-trip through unmarshalPropertyValue: the engine sent a property map missing registration metadata, a nested value type the unmarshaler rejects, or the resource state contains an unsupported nested type.","commonSituations":"Version mismatch between engine and Go SDK (marshal/unmarshal behavior drift); custom resources whose state includes types not representable in the gRPC value model; corrupted or hand-crafted Call requests.","solutions":["Read the wrapped cause after 'unmarshaling __self__:' — it names the specific value that failed to decode","Verify engine and Go SDK versions are compatible (upgrade the SDK to match your CLI)","Check the receiver resource's inputs/state for unsupported nested types (functions, channels, unregistered structs)","Reproduce with a minimal program to determine whether the issue is in the resource definition or the Call transport"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Verify receiver state only contains round-trippable values before registering the resource\nif hasUnsupportedNestedTypes(resourceArgs) {\n    return errors.New(\"receiver state contains types that cannot round-trip through gRPC\")\n}","typeGuard":"func isResourceValue(v any) bool {\n    _, ok := v.(Resource)\n    return ok\n}","tryCatchPattern":"value, secret, err := unmarshalPropertyValue(ctx, ci.value)\nif err != nil {\n    return nil, fmt.Errorf(\"unmarshaling __self__: %w\", err)\n}\n// caller: inspect errors.Unwrap(err) to identify the failing field","preventionTips":["Keep engine CLI and Go SDK versions aligned","Avoid func/channel/unregistered-struct fields in resource args","Pin and test against a specific CLI/SDK version pair"],"tags":["go","pulumi-sdk","unmarshaling","rpc"],"backgroundTag":"value-unmarshaling-failed","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}