A user uploaded a photo of a Thai menu and asked my site to translate it. The OCR step came back with a full page of fluent Thai and no error. The translation step translated it faithfully. The user got their menu back with "argument", "parameter list" and "command result" typeset over the dishes.
The OCR model had read อาหาร ("food") as อาร์กิว (a transliteration of "argument") and kept going in that register for the whole page. It didn't produce garbage. It produced a plausible page in the right alphabet about a different subject. Nothing in the response said anything was wrong, because nothing upstream knew.
I run picturetotext.app, which turns a photo into the file you actually wanted: an editable Word doc, an Excel sheet, a translated image. Behind each of those is a chain of up to three OCR engines, picked from five: three generative document readers, one classic detector-plus-recognizer, and sometimes a general-purpose vision LLM reading the image directly. The chain moves to the next engine when one doesn't deliver.
I'm calling the engines A, B, C and D below. This isn't a vendor comparison, every one of them is the best choice for something in my chain, and the failure shapes are what carry over to whatever you're running.
At first, "didn't deliver" meant an HTTP error, a timeout, or a low confidence score. That catches the old kind of OCR failure, where the engine knows it struggled. It misses the new kind entirely. Generative readers don't struggle visibly. When they can't see the page, they write one.
This post is the four shapes that failure took on real uploads over the past month, and the check I now run on each engine's output before trusting it. None of the checks calls a model. All of them are under 250 lines.
The setup, briefly
Each "leg" of the chain is one engine with a time budget. A leg either delivers or it doesn't, and one function decides which:
- failed, over budget, or the output fails a check → try the next leg
- rate-limited (429) → stay on this leg and retry; a different engine isn't a fix for a busy one
- image expired, internal error, whole-chain timeout → stop
The checks below all count as a leg not delivering. They read only what the engine returned, and they each raise a specific error code so the next leg, the logs, and my daily review can tell them apart.
1. The right alphabet, the wrong language entirely
That was the Thai menu. Engine A officially supports eight languages (Chinese, English, Japanese, Korean and four European ones). It has no language parameter and returns no confidence score. Show it a page in a ninth language and it doesn't refuse.
The thing a fabrication like that can't hide is its script. Engine A invented Thai in Thai letters. So the output itself is the language detector: count the letters that fall outside the scripts the engine is trusted with.
const A_TRUSTED = /[\p{Script=Latin}\p{Script=Cyrillic}\p{Script=Han}\p{Script=Bopomofo}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u; const TOLERATED = /\p{Script=Greek}/u; // formulas, not a language const SCRIPTLESS = /[\p{Script=Common}\p{Script=Inherited}]/u; function countScripts(text: string) { let letters = 0, foreign = 0, tolerated = 0; for (const ch of text) { if (!/\p{L}/u.test(ch) || SCRIPTLESS.test(ch)) continue; letters++; if (A_TRUSTED.test(ch)) continue; if (TOLERATED.test(ch)) tolerated++; else foreign++; } if (letters && tolerated / letters > 0.5) foreign += tolerated; // a Greek *page* return { letters, foreign }; } // fails when ≥3 foreign letters AND ≥3% of all letters The details that took more than one try:
- Both thresholds, not one. A stray symbol on a long page shouldn't send a good read away, and neither should two odd letters on a three-word sticker. A Thai menu with English subtitles is far above 3%.
- Greek is tolerated, not trusted. α, β and Ω are all over the physics handouts this engine is good at. A page that's mostly Greek is a Greek page, and that goes to the next leg.
- Some letters belong to no script. The katakana long-vowel mark ー is
Script=Common. So are IPA stress marks and math italic 𝑥. Before I excluded those, a katakana coffee menu (コーヒー) failed the check on its own vowel marks. - Bopomofo is in the trusted list because it only exists to annotate Chinese. A Taiwanese school worksheet is a Chinese page.
The threshold is deliberately low because the costs are lopsided. A false alarm costs one extra synchronous call to Engine B, which reads everything Engine A does and more. A miss costs a user a fabricated page, and on the translation product a fabricated translation painted over their photo.
What it can't catch: a misread inside a supported script (smudged Chinese), a Latin-script language Engine A doesn't support (Vietnamese, Turkish, Polish all pass), and an engine that transliterates an unknown script into Latin.
2. The right alphabet, the wrong language
That last gap showed up within two weeks. Two Kazakh pages went in. Kazakh is written in Cyrillic, which Engine A trusts. Engine A read both and quietly turned the Cyrillic into Latin, so the script check saw an all-Latin page and passed it. Handwritten Tamil does the same thing: it comes back as Latin gibberish, which the script check also passes.
The script check is free because it reads the output. A language check needs a model, and I didn't want to add a serial model call to every single-image job. So it runs in parallel:
- When the job is submitted, start a language-identification call in the background (a small, cheap text LLM with reasoning turned off) and write the answer to its own KV key.
- When Engine A finishes, look up the key. If the language is outside Engine A's eight, fail the leg with
ocr_language_unsupported. - If the answer isn't back yet, don't wait. Accept Engine A's output and log
lang_not_ready.
That third rule makes the check's real coverage measurable: the share of jobs logging lang_not_ready is how often it was too slow to matter. It costs one extra cheap model call per single-image job. On batch uploads the chain already asks for the language once for the whole batch, so there the answer just picks a different first engine.
One thing I did not do is store the language on the job record. The job record is rewritten on every client poll, so any field on it is a race. Side data goes in side keys.
3. Half a table, reported as done
A user photographed an inspection report sideways: three tables, 13 columns, around 120 cells. Engine A returned the header row, then one cell, <td>OK, and stopped. No closing tag, no error, status done. The user downloaded a .docx with an empty table, and the chain never asked the next engine.
The check is almost embarrassingly small. Every layout engine I use closes the tables it finishes, so an open <table without a matching </table> means a read that stopped:
const opened = (md.match(/<table\b/gi) ?? []).length; const closed = (md.match(/<\/table\s*>/gi) ?? []).length; if (opened > closed) throw quality("ocr_table_truncated"); The part that mattered was where it's allowed to fire. It's only switched on for legs that have another leg behind them. On the last leg, vetoing half a table turns a partial file into no file, which is worse for the user. A check is a reason to try someone else, not automatically a reason to fail.
What it can't catch: a table that closes properly but lost rows on the way. Telling that apart from a genuinely short table needs a heuristic, and I haven't found one I trust yet.
4. The model that graded its own blur "readable"
This one came from my regression set rather than from a user, on the day I'm writing this.
The photo is a monitor shot so far out of focus that no word on it is legible. Engine A failed upstream. Next was Engine B, the one engine in that chain that returns a quality score. It had correctly vetoed this exact image the day before. This time it scored the page readable and returned 31 lines:
- "The following table provides the information in English:", fourteen times
- an invented bank contract in Chinese, twice
- and, somewhere in the middle, "The image is too blurry to recognize any text content."
The job finished done. So a score from the engine is evidence, not a verdict. The same image can get a different score from the same engine on a different day.
A generative reader that can't see the page tends to loop: the same sentence, over and over. Real pages rarely do, and the lines they do repeat have a recognizable shape. So the check counts prose lines only:
- table rows (
|…,<tr>,<td>) are skipped, because repeated cells are what forms look like; - lines shorter than 8 characters, or less than half letters, are skipped (
1.,---,Name: ________, dates).
If one line accounts for at least 30% of at least 10 counted lines and appears 6+ times, the leg fails with ocr_repetition.
Unlike the table check, this one runs on the last leg too. Half a table is half a file; a loop is no file at all. And when it fires on the scored engine, it ends the chain instead of passing the image along. The leg after Engine B is Engine C, which returns no score and runs none of these checks. If the only engine that can judge the page says it can't be read, handing that page to an engine that can't judge anything doesn't produce a better answer, just an unchecked one.
What it can't catch: a loop inside a single line (one handwritten Arabic page in my set has a formula with 33 consecutive 1s), and a loop that rotates through several different lines.
A side effect: which error do you show?
Once checks can fail a leg, a chain can now fail three times for three different reasons, and you have to pick one message for the user. My rule was "report the first leg's error, because it describes this image". Two cases broke it:
- The first engine was only unsure of itself. An Arabic poster went into the Excel tool. The first leg failed the script check ("this engine can't read this"). Engine B read the whole page correctly and found there was no table on it. The user was told the text couldn't be read, when the true answer was "there's no table here." Now, when the first error is just an engine doubting itself, a later leg's verdict on the photo wins.
- The first engine was down. During an Engine A outage, a manga page sent to the Excel tool got "recognition failed, please retry". The other two engines had both read the page and concluded there was no table. When the first error is a service failure (timeout, upstream 5xx, empty response), the first later leg that said something about the image takes over.
Both are a few lines, both cost nothing, and both changed what users were told about their own photos.
How I find these at all
None of these failures shows up in error rates, because there are no errors. Two habits surfaced every one of them:
- A daily review of sampled outputs. A script pulls yesterday's short-lived diagnostic samples (image, engine output, which legs ran), runs some anomaly rules (fewer lines than expected, repetition, foreign script for the language), and I look at the flagged ones next to the photo. The Thai menu and the half table were both found this way, not reported.
- A regression set of 34 real uploads. It covers each product, single and batch, the main path, the fallback path, and images that should fail (a blank sheet, a fully blurred page, a photo with no table sent to the Excel tool). It runs the whole deployed chain and compares against a baseline after every deploy. It costs real money, so it isn't in CI. Every confirmed failure from the daily review becomes a sample once it's fixed. The blurry monitor broke on the very first run.
The expectations measure shape, not exact text: minimum characters, phrases that must appear, the dominant script, the longest back-to-back repeated word, the number of tables and sheets. Exact-match baselines on OCR output would turn red on every run, because these engines aren't deterministic.
One measurement worth sharing
When I moved Korean off Engine D (in one three-hour window it had rejected its own output on 83 of 88 Korean pages), I ran 19 Korean manga pages through the three candidates:
- Engine C read all 19. Where it disagreed with the others, the spot-checks went its way.
- Engine A said one page had no text. On the rest it misread or skipped speech bubbles: about 66% of syllables matched.
- Engine B said "no text" on 4 of the 10 pages it got, and read only 6 of 52 lines on another.
Nineteen pages is small, and it's one genre. But it's 19 more real pages than any leaderboard had for my use case, and it reversed my assumption. I'd have bet on the model with the best benchmark numbers.
What I'd tell myself a month ago
- Fallback on quality, not just on errors. With generative OCR, most of the failures that reach users have HTTP 200.
- Check the output's shape, not its content. Script, closing tags, repetition: each is cheap, deterministic, and impossible for the engine to fake while being wrong in that particular way.
- Write down what each check can't catch, next to the code. Every check above has a gap, and every gap I wrote down is where the next failure turned up.
- Decide what a veto means per leg. "Try the next engine", "fail the job", and "stop the chain" are three different decisions, and the right one depends on what's behind the leg.
The checks have been live for between a few days and two weeks, so I don't have clean firing rates yet. When I do, I'll post them, including the false positives.

