{"record":{"id":"a9b837f2ebf5eaf0","repo":"pulumi/pulumi","slug":"missing-self-argument-properties-for-provider","errorCode":null,"errorMessage":"missing __self__ argument properties for provider method call","messagePattern":"missing __self__ argument properties for provider method call","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resource/deploy/source_eval.go","lineNumber":1261,"sourceCode":"\t\tparts := strings.Split(tok.Name().String(), \"/\")\n\t\tif len(parts) != 2 {\n\t\t\treturn nil, fmt.Errorf(\"invalid provider method token %v\", tok)\n\t\t}\n\n\t\tpackageName := tokens.Package(parts[0])\n\t\tproviderReq, err = parseProviderRequest(\n\t\t\tpackageName, req.GetVersion(),\n\t\t\treq.GetPluginDownloadURL(), req.GetPluginChecksums(), nil,\n\t\t)\n\n\t\tself, ok := req.GetArgs().Fields[\"__self__\"]\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"missing __self__ argument for provider method call\")\n\t\t}\n\n\t\tselfFields := self.GetStructValue().Fields\n\t\tif selfFields == nil {\n\t\t\treturn nil, errors.New(\"missing __self__ argument properties for provider method call\")\n\t\t}\n\n\t\tprovURN, hasProvURN := self.GetStructValue().Fields[\"urn\"]\n\t\tif !hasProvURN {\n\t\t\treturn nil, errors.New(\"missing __self__.urn for provider method call\")\n\t\t}\n\n\t\tprovID, hasProvID := self.GetStructValue().Fields[\"id\"]\n\t\tif !hasProvID {\n\t\t\treturn nil, errors.New(\"missing __self__.id for provider method call\")\n\t\t}\n\n\t\trawProviderRef = fmt.Sprintf(\"%s::%s\", provURN.GetStringValue(), provID.GetStringValue())\n\t} else if req.Provider != \"\" {\n\t\trawProviderRef = req.GetProvider()\n\t} else {\n\t\t// Use the provider information from __self__\n\t\targs := req.GetArgs()","sourceCodeStart":1243,"sourceCodeEnd":1279,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/resource/deploy/source_eval.go#L1243-L1279","documentation":"When a provider-type method call supplies an `__self__` argument, the engine expects it to be a struct of the provider resource's properties. This error fires when `__self__` exists but its StructValue has no fields (nil field map), so the engine cannot extract the urn/id needed to build the provider reference. It indicates a malformed `__self__` payload rather than a missing one.","triggerScenarios":"A ResourceCallRequest where args[\"__self__\"] is present but serializes to an empty/struct-less value (e.g. the value is not a struct, or an empty struct was marshaled for the provider resource); an SDK serializing a provider resource whose outputs are empty and non-serializable into fields.","commonSituations":"Provider resource created with unknown/placeholder outputs during preview marshaled incorrectly; a buggy or outdated language SDK sending an empty `__self__` struct; hand-built grpc requests passing `structpb.NewStruct(&structpb.Struct{})`.","solutions":["Upgrade language SDK and CLI to matched versions so `__self__` is marshaled with urn and id fields","Verify the provider resource being passed actually has registered urn/id outputs before the method call","If crafting the RPC manually, populate `__self__` as a struct containing at least `urn` and `id` keys","File/inspect provider plugin logs to see what was serialized into `__self__`"],"exampleFix":"// before\n\"__self__\": structpb.NewStructValue(&structpb.Struct{})\n// after\n\"__self__\": structpb.NewStructValue(&structpb.Struct{Fields: map[string]*structpb.Value{\n  \"urn\": structpb.NewStringValue(urn), \"id\": structpb.NewStringValue(id),\n}})","handlingStrategy":"validation","validationCode":"self := req.GetArgs().GetFields()[\"__self__\"]\nif self == nil || len(self.GetStructValue().GetFields()) == 0 {\n    return fmt.Errorf(\"__self__ for %q must be a non-empty struct with urn/id\", tok)\n}","typeGuard":"func selfHasFields(v *structpb.Value) bool { return v != nil && len(v.GetStructValue().GetFields()) > 0 }","tryCatchPattern":"if err := callMethod(...); strings.Contains(err.Error(), \"missing __self__ argument properties\") {\n    // re-serialize the receiver resource and retry\n}","preventionTips":["Serialize the full provider resource into __self__, not an empty struct","Verify receiver outputs (urn, id) are known before invoking methods","Pin SDK/CLI versions together in CI"],"tags":["grpc","provider-method-call","serialization"],"backgroundTag":"missing-self-argument","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}