# Error: could not load provider for resource ... could not find provider urn:pulumi:...

## TL;DR
Your state points at a provider version that is not installed anymore. Back up state with `pulumi stack export`, rewrite the stale provider URN to the installed version, re-import, then destroy or update.

## The error

```
error: could not load provider for resource urn:pulumi:[stack]::[project]::eks:index:Cluster$aws:eks/cluster:Cluster::eksCluster: could not find provider urn:pulumi:[stack]::eks::pulumi:providers:aws::default_6_37_1::[id]
```

## Fix it

1. Back up state before touching anything: `pulumi stack export > stack.json` and keep a copy somewhere safe.
   - Success check: `stack.json` exists and is valid JSON.
2. Find which provider version IS installed: `pulumi plugin ls` and note the aws provider version (e.g. 6.40.0).
   - Success check: you have a concrete installed version.
3. In a copy of the export, replace every occurrence of the stale provider URN segment (e.g. `default_6_37_1`) with the installed one (e.g. `default_6_40_0`), keeping the trailing id suffix consistent with the installed provider.
   - Success check: no occurrences of the old version string remain.
4. `pulumi stack import < stackmodified.json`, then re-run `pulumi destroy` or `pulumi up`.
   - Success check: the provider loads and the operation proceeds.

## When to use this
You hit this when destroy/update fails at provider load after a CLI or provider upgrade changed which provider versions are installed.

## When NOT to use this
Do not use this for "failed to download plugin" errors. That is a missing plugin; install it with `pulumi plugin install resource aws [version]` instead.

## Compatibility
Pulumi CLI 3.x. The URN surgery approach works across provider versions.

## Variants
- `error: could not load provider for resource [urn]: could not find provider [urn]` naming any provider
- The same failure on `pulumi preview` when the preview needs the provider

## Root cause
State records the exact provider instance (name + version + id) each resource was created with. Upgrading the CLI does not rewrite those references, so if the old provider binary is gone, even a destroy cannot load what it needs.

## Edge cases
- If the replacement still fails, the id suffix may also need to match an installed provider instance. Compare against `pulumi plugin ls` output carefully.
- `--disable-integrity-checking` does not bypass this; the provider binary itself is missing.
