## TL;DR

The scan hit its time budget before finishing, which is normal on large histories. Give it more time, narrow the scope to what changed, or split the history into chunks. The timeout is a guardrail, not a bug.

## Error

```text
"trufflehog: context deadline exceeded" scanning repo
```

## Steps

1. Estimate the repo size (commits, total objects) to confirm scale is the cause. Expected: a large history, not a hung process.
2. Raise the timeout flag for the run. Expected: the scan gets further or completes.
3. Narrow the scope: scan only recent history or specific branches instead of everything. Expected: the bounded scan completes quickly.
4. For full-history needs, chunk by commit range and run sequentially. Expected: each chunk fits in the budget.
5. Record the working scope and timeout in the scan job so it stays reproducible. Expected: future runs do not regress.

## When to use

- Trufflehog times out on big repos.
- You need a full-history scan but cannot finish in one run.

## When not to use

- Authentication failures (fix creds, not timeouts).
- The scan hangs on one commit (investigate that commit).

## Tool compatibility

- Trufflehog v3; timeout flags on git and filesystem scans.

## Variant phrasings

### trufflehog timed out scanning

Same handling.

### trufflehog scan killed on large repo

Identical; scope or chunk.

## Why it happens

Trufflehog walks every commit and runs detectors on each diff. History size multiplies work, and the default deadline assumes a modest repo.

## Edge cases

- Shallow clones scan fast but miss history; use them only for pre-merge checks.
- Binary-heavy repos slow detectors; excluding binaries helps a lot.
- CI time limits may kill the job before trufflehog's own timeout; raise both.

## Provenance

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