{"record":{"id":"455693b2273f7e6e","repo":"pulumi/pulumi","slug":"resource-s-is-not-a-provider-type-s-provide","errorCode":null,"errorMessage":"resource %s is not a provider (type=%s); --provider must name a provider resource","messagePattern":"resource (.+?) is not a provider \\(type=(.+?)\\); --provider must name a provider resource","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/pulumi/do/do_shared.go","lineNumber":983,"sourceCode":"\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"load stack: %w\", err)\n\t}\n\tsnap, err := s.Snapshot(ctx, backendSecrets.DefaultProvider)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"load stack snapshot: %w\", err)\n\t}\n\tif snap == nil {\n\t\treturn nil, fmt.Errorf(\"stack has no snapshot yet; cannot resolve --provider %s\", providerURN)\n\t}\n\tfor _, res := range snap.Resources {\n\t\tif res.URN != providerURN {\n\t\t\tcontinue\n\t\t}\n\t\t// Sanity-check: the URN must refer to a provider resource. Providers have a type token of\n\t\t// the form \"pulumi:providers:<pkg>\"; anything else is almost certainly a user error.\n\t\tif !strings.HasPrefix(string(res.Type), \"pulumi:providers:\") {\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"resource %s is not a provider (type=%s); --provider must name a provider resource\",\n\t\t\t\tproviderURN, res.Type,\n\t\t\t)\n\t\t}\n\t\t// The provider package must also match: AWS provider inputs handed to an Azure\n\t\t// Configure call would either fail with a confusing schema mismatch or — worse — silently\n\t\t// authenticate against the wrong cloud. Reject early with a clear message.\n\t\texpectedType := tokens.Type(\"pulumi:providers:\" + pc.spec.Name())\n\t\tif res.Type != expectedType {\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"resource %s is a provider for a different package (type=%s); --provider must name a %s resource\",\n\t\t\t\tproviderURN, res.Type, expectedType,\n\t\t\t)\n\t\t}\n\t\t// Clone so we don't hand callers an aliasing pointer into the snapshot's state.\n\t\treturn maps.Clone(res.Inputs), nil\n\t}\n\treturn nil, fmt.Errorf(\"no resource named %s in the current stack\", providerURN)","sourceCodeStart":965,"sourceCodeEnd":1001,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/pulumi/do/do_shared.go#L965-L1001","documentation":"The URN supplied to --provider resolves to a resource whose type is not `pulumi:providers:<pkg>`, i.e. a regular resource rather than a provider. The CLI sanity-checks this to fail fast with a clear message instead of a confusing schema error later.","triggerScenarios":"Passing a URN of a bucket, VM, or other user resource to --provider during upsert/configure; e.g. --provider urn:pulumi:prod::infra::aws:s3/bucket:Bucket.","commonSituations":"Copy-pasting a URN from `pulumi stack` output and picking the wrong resource line; confusing a provider's child resource with the provider itself; scripting URN extraction incorrectly.","solutions":["Find the provider URN: it looks like urn:pulumi:<stack>::<project>::pulumi:providers:<pkg>::<name> — use that","Run `pulumi stack export | grep 'pulumi:providers'` to list provider URNs","Correct the --provider argument to name the provider resource, not a managed resource"],"exampleFix":"// before\n--provider urn:pulumi:prod::infra::aws:s3/bucket:Bucket\n// after\n--provider urn:pulumi:prod::infra::pulumi:providers:aws::default","handlingStrategy":"validation","validationCode":"pulumi stack export | jq -e --arg urn \"$URN\" 'any(.deployment.resources[]; .urn == $urn and (.type | startswith(\"pulumi:providers:\")))' >/dev/null || { echo \"URN is not a provider\"; exit 1; }\n","typeGuard":null,"tryCatchPattern":"if err := run(); err != nil {\n\tif strings.Contains(err.Error(), \"is not a provider\") {\n\t\tfmt.Fprintln(os.Stderr, \"use a pulumi:providers:* URN\")\n\t}\n}","preventionTips":["Select URNs by grepping for pulumi:providers: prefix","Never hand-pick URNs from full resource lists","Validate URN type programmatically in scripts"],"tags":["provider","urn","validation","cli"],"backgroundTag":"not-a-provider-resource","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}