{"record":{"id":"26d95b55ce929285","repo":"pulumi/pulumi","slug":"provider-v-not-found-in-snapshot","errorCode":null,"errorMessage":"provider %v not found in snapshot","messagePattern":"provider (.+?) not found in snapshot","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/importer/hcl2.go","lineNumber":162,"sourceCode":"\t}\n\n\t// Otherwise we'll need to load the appropriate package for this resource. We'll do this by grabbing the resource's\n\t// provider reference and looking up that provider resource in the current program snapshot. From there, we can build\n\t// a package descriptor and load the package and its schema.\n\tproviderRef, err := sdkproviders.ParseReference(state.Provider)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"parse resource provider reference: %w\", err)\n\t}\n\n\tvar provider *pkgresource.State\n\tfor _, s := range importState.Snapshot {\n\t\tif s.URN == providerRef.URN() && s.ID == providerRef.ID() {\n\t\t\tprovider = s\n\t\t\tbreak\n\t\t}\n\t}\n\tif provider == nil {\n\t\treturn nil, nil, fmt.Errorf(\"provider %v not found in snapshot\", providerRef)\n\t}\n\n\tpackageName := state.Type.Package()\n\tif sdkproviders.IsProviderType(state.Type) {\n\t\t// When the type is a provider type, the type triple is in the form\n\t\t// pulumi:providers:pkg instead of pkg:mod:type, so use the token \"name\"\n\t\t// position as the package instead.\n\t\tpackageName = tokens.Package(state.Type.Name())\n\t}\n\tpluginName, err := providers.GetProviderName(packageName, provider.Inputs)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"get provider name: %w\", err)\n\t}\n\tpluginVersion, err := providers.GetProviderVersion(provider.Inputs)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"get provider version: %w\", err)\n\t}\n\tdownloadURL, err := providers.GetProviderDownloadURL(provider.Inputs)","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/importer/hcl2.go#L144-L180","documentation":"After parsing the provider reference, the importer searches the current program snapshot for a resource state whose URN and ID match the provider reference. If no match is found (provider == nil), it throws \"provider %v not found in snapshot\". This means the import input references a provider that doesn't exist in the stack's state.","triggerScenarios":"Running `pulumi import` when the provider reference in the import state points to a provider resource absent from the target stack's snapshot — e.g. wrong stack selected, provider deleted, or a stale/hand-crafted provider ID.","commonSituations":"Importing into a different stack than the one whose provider ID was captured; provider was replaced/refreshed so its ID changed; pointing at a stack whose state has never created that provider.","solutions":["Select the correct stack (`pulumi stack select <stack>`) so the snapshot contains the referenced provider.","Run `pulumi refresh` and re-run import so provider IDs are current.","Update the import definition's provider field to the provider URN+ID that actually exists in the snapshot (`pulumi stack export` to check)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"exported, _ := stack.Export(ctx)\nfor _, r := range exported.Resources {\n\tif r.URN == providerRef.URN() && r.ID == providerRef.ID() {\n\t\tfound = true\n\t}\n}\nif !found { /* select correct stack or refresh */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run `pulumi stack select` for the intended stack before import.","Refresh state before building import definitions so provider IDs are current.","Cross-check provider URN+ID against `pulumi stack export`."],"tags":["import","snapshot","providers"],"backgroundTag":"provider-not-in-snapshot","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}