# reference_unresolved

> A reference could not be resolved. A ${{ … }} reference points at something that does not exist in that environment, for example a database that has not been created yet or a misspelt service name.

**A reference could not be resolved.** A `${{ … }}` reference points at something that does not exist in that environment, for example a database that has not been created yet or a misspelt service name.

- **HTTP status:** `422 Unprocessable Content`
- **CLI exit code:** `2` (the request or file is not valid)
- **Retry:** not as it is; the same request will fail the same way until the cause is fixed

## How to fix it

Check that {reference} names an existing database, service or variable in {environment}.

Words in `{braces}` are filled in from the error response, which names the exact resource.

## Common causes

- A typo, such as `${{ databases.mian.url }}`.
- The database exists in production but not in this preview environment.

## What the response looks like

```json
{
  "type": "https://guv.dev/errors/reference_unresolved",
  "title": "A reference could not be resolved",
  "status": 422,
  "code": "reference_unresolved",
  "detail": "A `${{ … }}` reference points at something that does not exist in that environment, for example a database that has not been created yet or a misspelt service name.",
  "fix": "Check that {reference} names an existing database, service or variable in {environment}.",
  "docs_url": "https://guv.dev/errors/reference_unresolved",
  "request_id": "req_01jbx2m9k7q4r8t5v6w3y0z1rq"
}
```

The `code` field is stable: match on it, not on `title` or `detail`, which may be reworded.
