## TL;DR

The scan target path does not exist from the working directory where the command ran. Print the working directory, resolve the path, and rerun with a correct one.

## Error

```text
"detect-secrets scan failed: no such file"
```

## Steps

1. Print the working directory and list the target path. Expected: you see the mismatch.
2. Check for typos, moved directories, or a CI checkout at a different path. Expected: the real location.
3. Rerun with the corrected path or from the right directory. Expected: the scan starts.
4. If the path is generated (submodule, sparse checkout), ensure the setup step runs before the scan. Expected: the path exists when the scan runs.
5. Pin the working directory in the CI job so it cannot drift. Expected: stable runs.

## When to use

- detect-secrets fails immediately naming a file or directory.
- After repo restructures or CI changes.

## When not to use

- Baseline load errors (different message).
- The scan runs but finds nothing (tune plugins instead).

## Tool compatibility

- Yelp detect-secrets CLI.

## Variant phrasings

### detect-secrets path does not exist

Same fix.

### detect-secrets scan target missing

Identical.

## Why it happens

Scan commands embed paths that rot when repos move or CI checkouts change, and the error surfaces only at scan time.

## Edge cases

- Symlinked paths resolve differently per OS; use real paths in CI.
- Submodules that fail to init look like missing directories.
- Excluding the missing path is wrong if it should be scanned; fix the path, not the config.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_hw5QfEAf2O6ggqzq-3FQfA
