engineering · december 2026

My OCR models never threw an error. They wrote a different page instead.

published · December 3, 2026 · by the picture to text team

A user uploaded a photo of a Thai menu and asked our 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 did not 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.

We run picturetotext.app, which turns a photo into the file you actually wanted: an editable Word document, an Excel workbook, or a translated image. Behind each tool sits a fallback chain of OCR engines — generative document readers paired with classic recognizers and vision models. The chain moves to the next engine when one fails to deliver.

We call the engines A, B, C and D below. This is not a vendor shootout: each engine earns its place on a different slice of inputs, and the failure shapes carry over to whatever generative OCR stack you run.

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 do not struggle visibly. When they cannot see the page, they write one.

Below are the four silent failure shapes we caught on real uploads, and the deterministic checks we now run on each engine’s output before trusting it. None of the checks calls a large model; all of them fit in under 250 lines of TypeScript.

Four generative OCR failure shapes all reported as HTTP 200 success: invented words in the right alphabet, an unsupported language in a supported script, half a table marked done, and a blurry photo graded readable
Four failure shapes caught on real uploads — every one returned HTTP 200 and looked successful to standard error monitoring.

01The setup: fallback on quality, not only HTTP errors

Each “leg” of the chain is one engine with its own time budget. One decision function classifies the outcome of every leg:

  • Failed, over budget, or failed an output check → advance to the next leg.
  • Rate-limited (429) → stay on this leg and retry; switching engines is not a fix for a busy one.
  • Image expired, internal error, or whole-chain timeout → stop and surface the error.
Document OCR fallback chain: Engine A with script, table and repetition checks, then Engine B with score veto and repetition check, then Engine C with repetition check
Every output check raises a distinct error code so logs, fallback routing and daily audits can tell why a leg was rejected.

02The right alphabet, the wrong language entirely

That was the Thai menu. Engine A officially supports eight languages (Chinese, English, Japanese, Korean and four European languages). It takes no language parameter and returns no confidence score. Hand it a page in a ninth language and it does not refuse — it hallucinates fluent words in that script.

The one signal a fabrication cannot hide is its Unicode script. Engine A invented Thai in Thai letters, so the output itself acts as a zero-cost script detector: count the letters outside the scripts the engine is trusted to read.

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
  • Both thresholds, not one: a stray symbol on a long report should not trigger a fallback, and neither should two odd characters on a short sticker. A Thai menu with English labels sits far above 3%.
  • Greek is tolerated, not trusted: α, β and Ω appear throughout physics handouts. A page that is mostly Greek is treated as Greek and routed to the next engine.
  • Exclude scriptless letters: the katakana long-vowel mark ー has Script=Common. Before excluding Common and Inherited, a coffee menu (コーヒー) failed the check on its own vowel marks.
  • Bopomofo stays trusted: it only annotates Chinese, so Taiwanese worksheets remain on the fast path.

What this check cannot catch: a misread inside a supported script, an unsupported Latin-script language (Vietnamese, Turkish, Polish), or an engine that transliterates an unknown script into Latin letters.

03The right alphabet, the wrong language

That gap showed up within two weeks. Two Kazakh pages went in. Kazakh uses Cyrillic, which Engine A trusts. Engine A quietly turned both pages into Latin gibberish, so the script check saw all-Latin text and passed them. Handwritten Tamil did the same thing.

Checking language requires a model call, and we did not want to add serial latency to every single-image job. Instead, language detection runs in parallel:

  • On submit, kick off a fast, non-reasoning language-identification call in the background and write the result to its own side key (never the job record, which is rewritten on every poll).
  • When Engine A finishes, read that key. If the language is outside Engine A’s eight, reject the leg with ocr_language_unsupported.
  • If the answer is not back yet, do not wait. Accept Engine A’s output and log lang_not_ready so we can measure real coverage. On batch OCR stacks, the first page identifies the language once for the whole batch.

04Half a table, reported as done

A user photographed an inspection report sideways: three tables, 13 columns, roughly 120 cells. Engine A returned the header row, a single <td>OK, and stopped — no closing tag, no error, status done. The downloaded .docx had a nearly empty table and the fallback chain never fired.

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 critical design detail was where this gate is enabled: only on legs that have another engine behind them. On the final leg, rejecting a half-finished table turns a partial file into no file at all. A quality gate is a reason to try another engine, not automatically a reason to fail the user.

What this check cannot catch: a table that closes cleanly with </table> after silently dropping rows in the middle.

05The model that graded its own blur “readable”

In our regression suite, one photo is a monitor shot so far out of focus that not a single word is legible. Engine A failed upstream. Next was Engine B — the only engine in that chain that outputs a readability score. The day before, it had vetoed the exact same photo. On this run, it graded the page readable and returned 31 lines:

  • “The following table provides the information in English:” — repeated fourteen times.
  • An invented Chinese bank contract — twice.
  • And in the middle: “The image is too blurry to recognize any text content.”

A readability score from an upstream model is evidence, not a verdict. Generative readers that cannot see a page tend to loop on the same sentence. Real documents rarely repeat identical prose lines, whereas forms repeat table cells and short labels.

Our repetition gate skips table rows (|…, <tr>, <td>) and short or punctuation-heavy lines (under 8 characters or under 50% letters). If one prose line makes up at least 30% of 10+ counted lines and appears 6 or more times, the leg fails with ocr_repetition. Unlike the table check, this gate runs on the final leg too — a loop is not half a file, it is garbage.

06A side effect: which error message do you show?

Once quality checks can reject a leg, a single upload can fail three legs for three different reasons. Our original rule was “report the first leg’s error because it describes the photo.” Two real cases broke that:

  • First engine doubted itself: an Arabic poster sent to Image to Excel failed the script check on leg 1, then Engine B read the entire poster and correctly reported “no table found.” The user deserves the verdict on the photo, not leg 1’s language limitation.
  • First engine had a service outage: during an Engine A outage, a manga page failed with a timeout on leg 1 while legs 2 and 3 both read it and found no table. When leg 1 fails for a service reason, the first later leg that actually judged the image takes precedence.

07How we find silent failures

None of these bugs appeared in HTTP error rates, because none of them threw an error. Two habits surfaced every one:

  • Daily review of flagged outputs: an automated script scans short-lived diagnostic samples for anomalies (unexpected script, repetition, suspiciously few lines) so we inspect flagged outputs side by side with the source photo.
  • A regression set of real uploads: covering single and batch runs, main and fallback paths, plus negative cases (blank pages, blurred screens, non-table photos). Assertions check output shape — dominant script, minimum characters, table/sheet counts, max repeated words — because generative OCR is not byte-deterministic.

The same habit reversed our engine choice for Korean: after Engine D self-rejected 83 of 88 Korean pages in three hours, testing 19 Korean manga pages across three candidates showed Engine C reading 19/19 accurately while the leaderboard favorites missed speech bubbles or returned “no text” on 4 of 10 pages.

08Takeaways

  • Fallback on quality, not just errors. Most generative OCR failures that reach users arrive with HTTP 200.
  • Check output shape, not semantics. Unicode script, unclosed HTML tables and prose repetition are cheap, deterministic and impossible for a hallucinating model to mask.
  • Document every check’s blind spots next to the code. Every gap we wrote down turned into the next real production failure we caught.
  • Decide per leg what a veto means. “Try the next engine”, “fail the job” and “stop the chain” are three distinct decisions depending on what sits behind the leg.

Want to see how these engines actually score on real pages? Read our four-tool image to Word benchmark, or test a tricky photo directly in the image to Word converter. If an output ever looks invented or cut short, flag it with the “not right?” link or via Contact.