> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tinyfish.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Fix Filter and Input Errors

> Find out why a search was rejected with INVALID_INPUT and which parameter to change to fix it

> [!NOTE]
>
> **Capability:** request validation

Use this when a search comes back with HTTP 400 and `INVALID_INPUT`. A parameter can be rejected on its own or because it conflicts with another one. The message names the field and the rule, so you can match it below.

An error looks like this:

```json theme={null}
{
  "error": {
    "code": "INVALID_INPUT",
    "message": "Field \"recency_minutes\": recency_minutes cannot be combined with after_date or before_date",
    "details": [
      {
        "code": "custom",
        "message": "recency_minutes cannot be combined with after_date or before_date",
        "path": ["recency_minutes"]
      }
    ]
  },
  "request_id": "..."
}
```

## Match your error

### Filters that conflict

| The message says | Cause | Fix |
| - | - | - |
| `recency_minutes cannot be combined with after_date or before_date` | You sent a relative window and a calendar range together | Keep one. See [recent results](https://docs.tinyfish.ai/tinysearch/how-to/recent-results.md) or [date window](https://docs.tinyfish.ai/tinysearch/how-to/date-window.md) |
| `after_date must be on or before before_date` | The range is reversed | Swap the dates |
| `date and recency filters are not supported for domain_type=research_paper` | A date or recency filter on a paper search | Remove it and use [publication year](https://docs.tinyfish.ai/tinysearch/how-to/papers-by-year.md) |
| `pub_year_min and pub_year_max are only supported for domain_type=research_paper` | A publication year bound on a web or news search | Add `domain_type=research_paper`, or remove the bound |
| `pub_year_min must be less than or equal to pub_year_max` | The year range is reversed | Swap the years |
| `include_domains and exclude_domains combined must be at most 1000 characters` | The two domain lists together are longer than 1,000 characters | Shorten the lists, or split the search into several requests |

### Filter values out of range

| The message says | Cause | Fix |
| - | - | - |
| `after_date must be YYYY-MM-DD` or `before_date must be YYYY-MM-DD` | The date is in another format, such as `06/01/2026`, or is not a real date | Use `YYYY-MM-DD` |
| `recency_minutes must be an integer` | `recency_minutes` has a decimal part or is not a number | Use a whole number of minutes |
| `recency_minutes must be >= 1` | `recency_minutes` is `0` or negative | Use `1` or more |
| `recency_minutes must be <= 5256000` | The window is longer than 5,256,000 minutes (about 10 years) | Use a smaller window, or [after\_date and before\_date](https://docs.tinyfish.ai/tinysearch/how-to/date-window.md) |
| `pub_year_min must be an integer` or `pub_year_max must be an integer` | The year has a decimal part or is not a number | Use a four-digit year, such as `2019` |
| `pub_year_min must be >= 0`, `pub_year_max must be >= 0`, `pub_year_min must be <= 9999` or `pub_year_max must be <= 9999` | The year is outside 0–9999 | Use a year from `0` to `9999` |

### Query, purpose, and page

| The message says | Cause | Fix |
| - | - | - |
| `query is required` | `query` is empty or only spaces | Send a non-empty `query` |
| `Invalid input: expected string, received undefined` on `query` | The request has no `query` parameter | Add `query` |
| `query too long` | `query` is longer than 2,000 characters | Shorten the query; move filters such as domains into their own parameters |
| `purpose too long` | `purpose` is longer than 2,000 characters | Shorten `purpose` to one or two sentences |
| `page must be <= 10` | `page` is above 10 | Use a page from `0` to `10`. See [paginate results](https://docs.tinyfish.ai/tinysearch/how-to/paginate.md) |
| `Too small: expected number to be >=0` on `page` | `page` is negative | Pages start at `0` |

## Common Mistakes

> [accordion] Fixing the field named in the message
>
> The field in the message is where validation failed, not always the one to change. For a paper search with `after_date`, the error names `domain_type`, but the fix is to remove `after_date`. Read the rule, then decide which side to change.

> [accordion] Retrying the same request
>
> A 400 will not succeed on retry. Change the request first.

## Related

> [card] [TinySearch API Reference](https://docs.tinyfish.ai/tinysearch/reference)
>
> Every parameter, accepted value, and error code

> [card] [Error Codes](https://docs.tinyfish.ai/error-codes.md)
>
> Full list of API error codes


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.