Errors come back as JSON, with a stable code to test in your code and a message to show or log:
details is there when there are several problems, one line each. Match on code, not on message: messages can be reworded.
An error never takes a request from your quota, nor an OSINT request. When a search fails after it was counted, the request is given back before the answer is sent. One exception: when the search service did answer but brought nothing back — file_not_found, rejected, a source_error read from its reply, file_withheld — the search is free up to a daily allowance (see Limits); past it, it counts like any search. A service that is down, busy or too slow is always free. An archive Orelys cannot check (archive_unchecked) is free for the first 10 a day, then within the same allowance. X-Request-Charged always tells you.

Error codes

Your request

Your key and your plan

Limits

The search service

A paused module is refused before anything is counted or charged. module_states in /v1/me lists the paused modules and categories.

Data breaches

The data breach routes are free: their errors never cost anything either.