## TL;DR
An agent retrying a filing API with the wrong CIK burns quota because the error (404 or empty) looks transient to a naive retry loop. Validate the CIK against the ticker mapping before the first call, and do not retry identifier errors: fail fast and fix the identifier.

## The error
```text
10 retries against CIK 0009999999 (invalid)
all returned 404; quota: 10 requests wasted.
Correct CIK was 0001234567; agent never re-resolved the ticker.
```

## Fix it
1. Stop identifier retries: classify 404-on-CIK as a non-retriable error in the agent's tool policy.
   Expected: Expected: the next bad CIK fails once with a clear message instead of ten times.
2. Add a pre-call validation: resolve the ticker through the SEC ticker-to-CIK mapping and confirm the CIK exists before calling the filing API.
   Expected: Expected: invalid CIKs are caught before any quota is spent.
3. When a CIK 404s despite validation, have the agent re-resolve the ticker (it may have changed via merger) rather than retrying the same CIK.
   Expected: Expected: the agent recovers by finding the new CIK instead of hammering the old one.
4. Budget quota per company in the pipeline config so one bad identifier cannot consume the run's allowance.
   Expected: Expected: a single bad CIK costs at most its validation call.

## When to use
- Your filing agent wasted API quota retrying a bad CIK.
- You need retry policies that distinguish transient errors from bad identifiers.
- You run agents against quota-limited filing APIs.

## When not to use
- The CIK was valid and the 404 was transient - then retry is correct, keep it.
- The API has no quota - then retries are wasteful but harmless.
- The agent had no way to validate the CIK - then add the mapping lookup.

## Why it happens
Retry logic written for transient failures (500s, timeouts) was applied uniformly, including to 404s caused by wrong identifiers. A wrong CIK will 404 forever, so each retry is pure quota burn. The fix is error classification: retry the transient, fail fast on the permanent.

## Variant phrasings
### agent retried wrong cik burned quota
Same failure and fix; some searchers phrase the query this way.
### filing api wrong cik retry loop
Same failure and fix; some searchers phrase the query this way.

## Edge cases
- CIKs change after mergers; a CIK that was valid last quarter can 404 today.
- Leading-zero padding errors (9 vs 10 digits) are the most common wrong-CIK cause.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_D6ob35c2ap-bdebnRCvoJw
