{"record":{"id":"fab028121efe778d","repo":"danielmiessler/Fabric","slug":"filename-contains-no-machine-readable-text-ocr","errorCode":null,"errorMessage":"${fileName} contains no machine-readable text. OCR is necessary, and the Fabric web interface does not include OCR.","messagePattern":"(.+?) contains no machine-readable text\\. OCR is necessary, and the Fabric web interface does not include OCR\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"web/src/lib/services/PdfConversionService.ts","lineNumber":12,"sourceCode":"import type { PdfProcessResult } from '@firecrawl/pdf-inspector-wasm';\nimport type { PdfRequest, PdfResponse } from '../workers/pdf-inspector.worker';\n\nexport interface PdfConversion {\n\tmarkdown: string;\n\twarning?: string;\n}\n\n// Maps the raw worker result to UI behavior. Throws when there is no usable text.\nexport function interpretPdfResult(result: PdfProcessResult, fileName: string): PdfConversion {\n\tif (result.pdfType === 'Scanned' || result.pdfType === 'ImageBased') {\n\t\tthrow new Error(\n\t\t\t`${fileName} contains no machine-readable text. OCR is necessary, and the Fabric web interface does not include OCR.`\n\t\t);\n\t}\n\tconst markdown = result.markdown;\n\tif (!markdown || markdown.trim().length === 0) {\n\t\tthrow new Error(`${fileName}: the conversion returned no text.`);\n\t}\n\tconst warnings: string[] = [];\n\tif (result.pdfType === 'Mixed') {\n\t\twarnings.push(\n\t\t\t`${fileName}: pages ${result.pagesNeedingOcr.join(', ')} contain no machine-readable text. OCR is necessary for those pages, and their content is not included.`\n\t\t);\n\t}\n\tif (result.hasEncodingIssues) {\n\t\twarnings.push(`Some text in ${fileName} did not decode correctly.`);\n\t}\n\treturn warnings.length > 0 ? { markdown, warning: warnings.join(' ') } : { markdown };\n}","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/danielmiessler/Fabric/blob/338b89cfe97ab2d12ce30ce8b5449857a841366d/web/src/lib/services/PdfConversionService.ts#L1-L30","documentation":"interpretPdfResult throws when the WASM pdf-inspector classifies the PDF as 'Scanned' or 'ImageBased' — the file contains only images of text with no extractable text layer. The Fabric web UI deliberately has no OCR, so conversion is impossible and the error tells the user that explicitly.","triggerScenarios":"Uploading a scanned document (photo/scan-of-paper PDF), an exported-as-image PDF, or any PDF whose pages are a single full-page image with no text objects.","commonSituations":"Users dragging in scanned contracts/receipts; PDFs printed to 'image-only' by scanner software; documents exported from tools that rasterize pages.","solutions":["Run OCR on the file externally (e.g. ocrmypdf) and upload the OCR'd copy","Obtain a native-text version of the document (re-export from the source tool)","Surface this message to the user as-is in the UI toast — it already explains the remedy"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":"function isNoTextPdfError(e: unknown): boolean {\n  return e instanceof Error && e.message.includes('OCR is necessary');\n}","tryCatchPattern":"try { conversion = interpretPdfResult(result, fileName); }\ncatch (e) {\n  if (isNoTextPdfError(e)) { toast.info(e.message); return; } // actionable user guidance\n  throw e;\n}","preventionTips":["Show the thrown message verbatim — it already tells the user to OCR externally","Offer ocrmypdf or 'get a text-based export' guidance in the upload UI"],"tags":["pdf","ocr","validation","upload"],"backgroundTag":null,"analyzedSha":"338b89cfe97ab2d12ce30ce8b5449857a841366d","analyzedAt":"2026-08-15T11:38:51.759Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}