## TL;DR

dbt docs generate needs target/manifest.json from a prior parse or run in the same target path. Run dbt parse (or any build command) first with the same --target and target-path, then generate docs. If something wipes target between steps in CI, stop cleaning it or copy the manifest forward.

```text
dbt docs generate failed: 'manifest' artifact not found in target/
```

## Use this when

- dbt docs generate fails saying manifest artifact not found in target/
- target/ was deleted, or CI runs each dbt command in a fresh container or workspace
- you pass a custom --target-path or --target to one command but not the other

## Not for this skill when

- manifest exists but docs shows old content, regenerate and clear the docs hosting cache instead
- docs generate succeeds but the catalog is empty, that is a catalog or permissions issue
- you use dbt Cloud docs, which generates artifacts per job without a local target folder

## Steps

1. List the target directory dbt is using (default target/) and check whether manifest.json is present and recent.
   Verify: you know whether manifest.json exists and how old it is.

2. Run dbt parse with the same profile, target, and target-path you will use for docs. Confirm manifest.json is written and its timestamp updates.
   Verify: a fresh manifest.json exists in the expected target path.

3. Run dbt docs generate with identical flags, especially --target and --target-path if customized. Confirm index.html and catalog.json appear alongside the manifest.
   Verify: docs generate completes and target/index.html exists.

4. In CI, inspect the pipeline for clean steps between parse and generate (fresh checkout, target deletion, separate jobs without artifact upload). Merge the steps or pass target/ as a pipeline artifact between them.
   Verify: the CI pipeline preserves target/ from parse through docs generate.

## Variant phrasings

### works locally, fails in CI only
Local target folders persist between commands; CI workspaces often do not. This local vs CI split is the signature of this cause.

### manifest exists but is from another target
Generating docs for prod with a dev manifest mixes metadata. Keep one target path per environment in CI.

Compatibility: dbt-core 1.x docs generate; requires manifest.json and produces catalog.json plus index.html in the target path (default target/).

## Why it happens

Docs generation is a two-step design: parsing the project writes manifest.json describing every node, and generate reads that artifact to build the catalog and site. There is no project re-parse inside generate on demand, so a missing or mismatched target folder surfaces immediately as artifact not found.

## Edge cases / pitfalls

- Partial parsing can leave a manifest that lags model edits; run a full parse before generating release docs.
- Committing target/ to git to work around CI is a smell; pass it as a build artifact instead.
- catalog.json needs warehouse access for table stats; a manifest alone fixes this error but docs can still warn on catalog steps.

## Provenance

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