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

> ## Agent Instructions
> Unkey is two separate products. Compute builds, deploys, and runs apps behind a gateway. API Management issues API keys, enforces rate limits, manages identities and permissions, and reports usage. Say which product a page belongs to; a reader can use either without the other.
> Every Unkey API endpoint is an HTTP POST to https://api.unkey.com/v2/{service}.{procedure} with a root key in the Authorization: Bearer header. Root keys are workspace scoped.
> Error codes have the form err:{system}:{category}:{specific} and each has a page at /errors/{system}/{category}/{specific}.
> The word environment means production or preview in Compute. Rate limiting has four meanings on this site; the glossary lists them.

# Troubleshooting

> Fix a PlanetScale account that needs a reconnect and deployments whose credentials could not be created.

## Account needs a reconnect

If PlanetScale refuses the account's token, for example because you revoked access on the PlanetScale side, the account is marked as needing a reconnect. Until you connect the account again:

* Database actions for the account fail in the dashboard.
* New deployments fail in every environment connected to its databases, and so do stopped deployments that wake. The error is "The PlanetScale account of a connected database must be reconnected." A deployment that fails to wake stays stopped and shows this error in the **Instances** stage on its page.
* Running deployments keep working.

To fix it, a workspace admin opens the database on the project's databases page, clicks **Reconnect** in the banner, and signs in to PlanetScale as the user who connected the account. Signing in as a different user doesn't fix it.

## Deploy errors

Unkey creates a deployment's database credentials before the build. If that fails, the deployment fails before building, GitHub shows "Database credentials could not be created", and the deployment shows one of these errors:

| Error | Fix |
| - | - |
| "The PlanetScale account of a connected database must be reconnected." | [Reconnect the PlanetScale account](#account-needs-a-reconnect), then redeploy. |
| "A connected PlanetScale database has an environment variable name that is invalid or already used by another connected database." | Disconnect the environment and [connect it again](https://www.unkey.com/docs/compute/integrations/planetscale/connect.md#connect-a-database-to-an-app) with a different name. |
| "A connected PlanetScale branch has no replicas for its read-only URL." | Add a replica to the branch in PlanetScale, or [turn off the read-only URL](https://www.unkey.com/docs/compute/integrations/planetscale/environment-variables.md#read-only-replica-url). |
| "A connected PlanetScale branch no longer exists." | [Disconnect the environment](https://www.unkey.com/docs/compute/integrations/planetscale/connect.md#disconnect-and-remove) and connect it to another branch. |
| "The PlanetScale organization of a connected database is gone, or the connected account can no longer see it." | Check in PlanetScale that the organization still exists and that the user who connected the account can still see it. If the organization is gone, [disconnect the environment](https://www.unkey.com/docs/compute/integrations/planetscale/connect.md#disconnect-and-remove) and connect it to another database. |
| "The connected PlanetScale account no longer has access to a connected database." | Unkey retries before it shows this error. Give the user who connected the account access to the database again in PlanetScale, then redeploy. |
| "PlanetScale did not respond. Redeploy when PlanetScale is available again." | Unkey retries before it shows this error. Redeploy when PlanetScale is available again. |
| "PlanetScale database credentials could not be created." | Redeploy. If it fails again, contact support. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.