> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Why does the sandbox SDK raise CWSandboxAuthenticationError or WandbAuthError?

This article covers credential discovery with the Python SDK's built-in authentication strategies. Which credential the SDK looks for depends on the strategy you select. The SDK doesn't fall back from one strategy to the other.

The Python [quickstart](https://docs.coreweave.com/products/sandboxes/get-started.md#forge-api-key) uses `AuthStrategy.WANDB`. The [Dedicated Cloud guide](https://docs.coreweave.com/products/sandboxes/dedicated-cloud.md) passes credentials explicitly through `AuthHeaders`; for that example, check the variables and headers configured in the guide because the `wandb` credential-discovery settings below don't apply.

* **CoreWeave (default)**: reads `CWSANDBOX_API_KEY`, a [CoreWeave API access token](https://docs.coreweave.com/security/authn-authz/manage-api-access-tokens.md), and sends it as a bearer token. Requests go out unauthenticated when the variable isn't set.
* **Forge API key**: selected explicitly by passing `auth=AuthStrategy.WANDB`. Credential discovery is delegated to the `wandb` library, which accepts an active `wandb login` session, `WANDB_API_KEY`, or the `api.wandb.ai` entry in `~/.netrc`.

Check which credential you have configured, without printing its value:

```bash theme={"system"}
# CoreWeave API access token (the default strategy)
[ -n "$CWSANDBOX_API_KEY" ] && echo "CWSANDBOX_API_KEY is set" || echo "CWSANDBOX_API_KEY is not set"

# Forge API key (requires auth=AuthStrategy.WANDB)
[ -n "$WANDB_API_KEY" ] && echo "WANDB_API_KEY is set" || echo "WANDB_API_KEY is not set"
```

## Common issues

| Issue | Solution |
| - | - |
| No credentials configured | Set `CWSANDBOX_API_KEY`, or set a Forge API key and pass `auth=AuthStrategy.WANDB` |
| Invalid or expired CoreWeave API access token | [Create a new API access token](https://docs.coreweave.com/security/authn-authz/manage-api-access-tokens.md) from the cloud console |
| `WANDB_API_KEY` set but ignored | Pass `auth=AuthStrategy.WANDB` to use the `wandb` library's credential discovery |
| `W&B authentication requires the optional wandb dependency` | Install the extra with `uv pip install 'cwsandbox[wandb]'` |
| Sandbox creation fails with a valid Forge API key | Your default entity might be a personal entity or belong to an organization without sandbox access. With `AuthStrategy.WANDB`, set `WANDB_ENTITY` to a team you can access in an organization with sandbox access before the process starts. Check the entity-selection order below if a run is active. To request access for your organization, contact [support](mailto:forge-support@coreweave.com) |
| Sandbox lands in an unexpected entity or project | With `AuthStrategy.WANDB`, set `WANDB_ENTITY` and `WANDB_PROJECT` before the process starts. Check the entity-selection order below if a run is active |
| Netrc parse errors | Check `~/.netrc` file syntax and permissions |

With `AuthStrategy.WANDB` in `cwsandbox` 1.18.0 and later, the entity of an active `wandb.run` takes precedence over `WANDB_ENTITY` and settings files. If a run is active, configure it to use the intended team. When neither the run nor the settings select an entity, the API uses your default entity. If no project is configured, the API uses `sandbox`.

[Authentication & Access](https://docs.coreweave.com/support/sandboxes/tags/authentication-access.md)
