# Error: waiting for preview: [405] (after pulumi login)

## TL;DR
The CLI is talking to the wrong backend or with invalid credentials. Run `pulumi logout`, then `pulumi login` again (or `pulumi login --local` / your self-managed URL), verify with `pulumi whoami`, and retry.

## The error

```
error: waiting for preview: [405]
```

## Fix it

1. Check where you are logged in: `pulumi whoami`.
   - Success check: it prints your user/org. If it errors, you are not really authenticated.
2. `pulumi logout`, then log back in to the right backend: `pulumi login` for Pulumi Cloud, `pulumi login --local` for the local backend, or `pulumi login [your self-managed url]`.
   - Success check: login completes without errors.
3. Verify again with `pulumi whoami`, then `pulumi preview`.
   - Success check: the preview starts instead of 405ing.
4. If you use `PULUMI_ACCESS_TOKEN`, make sure it is valid and not expired, and that it belongs to the org that owns the stack.
   - Success check: token-based commands authenticate.

## When to use this
You hit 405s on preview/update right after login, or after switching backends, when the CLI and the stack disagree about where state lives.

## When NOT to use this
Do not use this for 401/unauthorized on a single command with an otherwise working login. That is usually an expired token; refresh it.

## Compatibility
Pulumi CLI 3.x, Pulumi Cloud and self-managed backends.

## Variants
- `error: waiting for update: [405]` (the same problem surfacing on `pulumi up`)
- `No credentials provided or are invalid` alongside the 405s

## Root cause
A 405 means the request hit an endpoint that does not support the method, which happens when the CLI targets the wrong API host or sends requests the backend does not recognize as authenticated. Re-login points the CLI at the right backend with fresh credentials.

## Edge cases
- Stacks created while logged into one backend cannot be updated while logged into another. The backend must match the stack's home.
- Corporate proxies can also produce 405s by mangling API paths. Rule out auth first, then check the proxy.
