pulumi/pulumi · error
missing __self__ argument properties for provider method cal
Error message
missing __self__ argument properties for provider method call
What it means
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.
Source
Thrown at pkg/resource/deploy/source_eval.go:1261
parts := strings.Split(tok.Name().String(), "/")
if len(parts) != 2 {
return nil, fmt.Errorf("invalid provider method token %v", tok)
}
packageName := tokens.Package(parts[0])
providerReq, err = parseProviderRequest(
packageName, req.GetVersion(),
req.GetPluginDownloadURL(), req.GetPluginChecksums(), nil,
)
self, ok := req.GetArgs().Fields["__self__"]
if !ok {
return nil, errors.New("missing __self__ argument for provider method call")
}
selfFields := self.GetStructValue().Fields
if selfFields == nil {
return nil, errors.New("missing __self__ argument properties for provider method call")
}
provURN, hasProvURN := self.GetStructValue().Fields["urn"]
if !hasProvURN {
return nil, errors.New("missing __self__.urn for provider method call")
}
provID, hasProvID := self.GetStructValue().Fields["id"]
if !hasProvID {
return nil, errors.New("missing __self__.id for provider method call")
}
rawProviderRef = fmt.Sprintf("%s::%s", provURN.GetStringValue(), provID.GetStringValue())
} else if req.Provider != "" {
rawProviderRef = req.GetProvider()
} else {
// Use the provider information from __self__
args := req.GetArgs()View on GitHub (pinned to 793f7b2e16)
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__`
Example fix
// before
"__self__": structpb.NewStructValue(&structpb.Struct{})
// after
"__self__": structpb.NewStructValue(&structpb.Struct{Fields: map[string]*structpb.Value{
"urn": structpb.NewStringValue(urn), "id": structpb.NewStringValue(id),
}}) Defensive patterns
Strategy: validation
Validate before calling
self := req.GetArgs().GetFields()["__self__"]
if self == nil || len(self.GetStructValue().GetFields()) == 0 {
return fmt.Errorf("__self__ for %q must be a non-empty struct with urn/id", tok)
} Type guard
func selfHasFields(v *structpb.Value) bool { return v != nil && len(v.GetStructValue().GetFields()) > 0 } Try / catch
if err := callMethod(...); strings.Contains(err.Error(), "missing __self__ argument properties") {
// re-serialize the receiver resource and retry
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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{})`.
Related errors
- unmarshaling inputs: %w
- unmarshaling outputs: %w
- missing __self__ argument for provider method call
- missing __self__.urn for provider method call
- missing __self__.id for provider method call
AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31).
Data as JSON: /api/errors/a9b837f2ebf5eaf0.
Report an issue: GitHub.