## TL;DR

Something queried `analytics.dim_customers` and the warehouse says it is not there. Either the model was never built in this target, it was built into a different schema, or it was dropped. Rebuild the model with `dbt run --select dim_customers`, verify the schema in your profile target, and confirm the relation exists before rerunning downstream work.

## Error

```text
RelationNotFound: relation 'analytics.dim_customers' does not exist
```

## Steps

1. Check whether the relation exists right now by querying your warehouse's information schema for `dim_customers` in schema `analytics`. Expected: you learn whether it is truly missing or just in the wrong schema.
2. Compare the schema against your profile target: the `schema` (and `database`) in profiles.yml for the active target must match where you are looking. Expected: the target schema equals `analytics`, or you adjust your expectation.
3. Rebuild the model: `dbt run --select dim_customers`. Expected: the run succeeds and the relation appears in the warehouse.
4. If a downstream model or a docs query triggered the error, rerun it now. Expected: the RelationNotFound error is gone.
5. If the relation keeps disappearing, check for a `--full-refresh` in a scheduled job or a drop step that removes it. Expected: you find the job responsible.

## When to use

- A dbt run, test, or docs query fails with RelationNotFound.
- You switched targets (dev to prod) and relations seem missing.

## When not to use

- dbt compile fails with a dependency error (the node is missing from the graph, not the warehouse).
- The relation exists but queries fail with permission errors (a grants problem).

## Tool compatibility

- dbt Core 1.0 and later, all adapters. Information schema queries differ slightly per warehouse.

## Variant phrasings

### relation "analytics.dim_customers" does not exist

The Postgres-style quoting of the same error; the fix is identical.

### RelationNotFound on a seed or snapshot

Seeds and snapshots are relations too; rebuild with `dbt seed` or `dbt snapshot`.

## Why it happens

dbt renders relation names from the target's database and schema plus the model name. A mismatch between where dbt built the model and where the query looks, or a model that was never built in this environment, produces this error.

## Edge cases

- Custom schemas via `generate_schema_name` change where models land; check the macro before assuming the default.
- On Snowflake, case matters: unquoted identifiers fold to uppercase.
- Cloned or time-traveled databases can hide recently built relations from the session that built them.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_bdvVfPTOggwj0Km7kfuOjw
