## TL;DR

dbt looked for a profile named `prod` and found nothing. Either profiles.yml has no `prod` target under your project profile, or dbt is reading a different profiles.yml than you edited. Add the target or fix `DBT_PROFILES_DIR`, then run `dbt debug --target prod`.

## Error

```text
"Cannot find profile named 'prod'" dbt debug
```

## Steps

1. Run `dbt debug --target prod` and note the profiles path it reports. Expected: you see exactly which profiles.yml dbt read.
2. Open that file and check the top-level keys: one must match your project's `profile:` name from dbt_project.yml, with a `prod` target beneath it. Expected: you find the missing key or the missing target.
3. If the file is wrong, set `DBT_PROFILES_DIR` to the directory containing the correct profiles.yml. Expected: dbt reads the intended file.
4. Add the `prod` target with all required fields for your adapter. Expected: the YAML has a complete `prod` block.
5. Run `dbt debug --target prod`. Expected: the profile is found and the connection check passes.

## When to use

- dbt reports "Cannot find profile named 'prod'" (or any target name).
- You just added a new target or moved profiles.yml.

## When not to use

- The profile is found but the connection fails (a credentials or network problem).
- dbt Cloud runs (profiles are managed in the UI, not in profiles.yml).

## Tool compatibility

- dbt Core 1.0 and later, all adapters. `DBT_PROFILES_DIR` behavior is adapter-independent.

## Variant phrasings

### Could not find profile named 'dev'

Same fix for the default target; the profile key must match dbt_project.yml.

### Profile not found in CI

CI usually needs `DBT_PROFILES_DIR` set or the file mounted into the job.

## Why it happens

dbt resolves the profile name from dbt_project.yml, then looks up the target inside profiles.yml. A mismatch at either level, or dbt reading a different profiles.yml, yields "cannot find profile".

## Edge cases

- The profile key is case-sensitive and must match `profile:` in dbt_project.yml exactly.
- A YAML syntax error can silently drop the target block; validate the file parses.
- Target names like `prod` are conventional only; dbt accepts any name you define.

## Provenance

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