{"record":{"id":"bfb9c8c546b9078c","repo":"danielmiessler/Fabric","slug":"filename-the-conversion-returned-no-text","errorCode":null,"errorMessage":"${fileName}: the conversion returned no text.","messagePattern":"(.+?): the conversion returned no text\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"web/src/lib/services/PdfConversionService.ts","lineNumber":18,"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}\n\nexport class PdfConversionService {\n\tprivate worker: Worker | null = null;\n\tprivate nextId = 1;\n\tprivate pending = new Map<\n\t\tnumber,","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/danielmiessler/Fabric/blob/338b89cfe97ab2d12ce30ce8b5449857a841366d/web/src/lib/services/PdfConversionService.ts#L1-L36","documentation":"interpretPdfResult throws when the PDF is not classified as scanned/image-based but result.markdown is empty or whitespace-only — the inspector found a text layer yet extracted zero usable text. This is a data-quality outcome of the WASM conversion, not a crash.","triggerScenarios":"PDFs whose 'text' is only invisible/empty glyph runs; fonts with broken ToUnicode maps yielding whitespace; a text layer consisting solely of whitespace or control characters.","commonSituations":"Designer PDFs with outlined/curved text; PDFs where text is drawn as vector paths; partially corrupt files that parse but yield nothing.","solutions":["Try re-exporting or re-saving the PDF from another tool (reprints a sane text layer)","If the file is effectively image-based despite classification, OCR it externally as in the scanned case","Report files where classification says text-bearing but extraction is empty — that is an inspector gap"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!result.markdown || result.markdown.trim().length === 0) {\n  // classify as 'unusable text layer' before interpretPdfResult throws\n}","typeGuard":"function isEmptyConversionError(e: unknown): boolean {\n  return e instanceof Error && e.message.includes('returned no text');\n}","tryCatchPattern":"try { conversion = interpretPdfResult(result, fileName); }\ncatch (e) {\n  if (isEmptyConversionError(e)) { toast.warn('This PDF has no extractable text. Re-export or OCR it.'); return; }\n  throw e;\n}","preventionTips":["Pre-check markdown emptiness to give a custom message","Treat zero-text conversions as user guidance, not crashes"],"tags":["pdf","text-extraction","validation"],"backgroundTag":null,"analyzedSha":"338b89cfe97ab2d12ce30ce8b5449857a841366d","analyzedAt":"2026-08-15T11:38:51.759Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}