## TL;DR
An empty result set mid-campaign is ambiguous: the campaign mail may be gone, the search index may lag, or the query may be malformed in a way the API accepts silently, such as a date format or field name it ignores by returning nothing. Never let a zero result close a campaign. Validate the query against a known message, check index timing, and fall back to folder enumeration with client-side filtering when search cannot be trusted.

```text
the agent's triage run failed after the mailbox search API returned empty mid-campaign
```

## Use this when
- Search returns zero for a campaign with confirmed delivered messages.
- The same query returns results at some times and empty at others.

## Not for this skill when
- The messages were purged already, so empty is correct. Confirm via message trace before changing code.
- The API returns an error, not an empty set. Handle the error path instead.

## Steps
1. Take one known campaign message id and query for it directly by id and by the campaign criteria. Verify: whether the item is findable at all is established.
2. Inspect the generated query string for field names, date formats and quoting against the API documentation. Verify: any malformed element is identified.
3. Check search index lag by comparing message arrival time with first findable time for a test message. Verify: expected lag is measured, not guessed.
4. Add a guard: an empty result during an active campaign triggers a verification probe and a fallback folder scan for the window, never silent success. Verify: the guard fires on a simulated empty response.
5. Re-run the campaign sweep. Verify: the found count matches the message trace count for the campaign.

## Variant phrasings
### mailbox search api empty results false zero campaign
The false empty variant.
### search query returns nothing known message index lag
The index lag variant.

Compatibility: Microsoft Graph search and KQL-style mailbox queries, Exchange eDiscovery search behaviour.

## Why it happens
Search APIs optimise for plausible answers. A malformed or premature query often returns a well-formed empty set rather than an error, because from the index point of view nothing matched. Agents that trust emptiness inherit the lie.

## Edge cases / pitfalls
- Log the exact query and the raw response for every sweep; debugging emptiness without them is guesswork.
- Date boundaries and time zones are the most common silent query killers in campaign sweeps.
- A canary message you control, sent to a test mailbox, makes query validation repeatable.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_-OoU_DgQsppmYx4VPqDdow
