{"record":{"id":"507377b728b409d5","repo":"Stirling-Tools/Stirling-PDF","slug":"jobstatus-error","errorCode":null,"errorMessage":"jobStatus.error","messagePattern":"jobStatus\\.error","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/editor/src/core/tools/pdfTextEditor/PdfTextEditor.tsx","lineNumber":772,"sourceCode":"                Math.max(jobStatus.progress ?? 0, 0),\n                100,\n              );\n              const stage = jobStatus.stage || \"processing\";\n              const message = jobStatus.note || \"Converting PDF to JSON...\";\n              const current = jobStatus.current ?? undefined;\n              const total = jobStatus.total ?? undefined;\n              setConversionProgress({\n                percent,\n                stage,\n                message,\n                current,\n                total,\n              });\n\n              if (jobStatus.complete) {\n                if (jobStatus.error) {\n                  console.error(\"Job failed:\", jobStatus.error);\n                  throw new Error(jobStatus.error);\n                }\n\n                console.log(\"Job completed, retrieving JSON result...\");\n                jobComplete = true;\n\n                const resultResponse = await apiClient.get(\n                  `/api/v1/general/job/${jobId}/result`,\n                  {\n                    responseType: \"blob\",\n                  },\n                );\n\n                const jsonText = await resultResponse.data.text();\n                const result = JSON.parse(jsonText);\n\n                if (!Array.isArray(result.pages)) {\n                  console.error(\n                    \"Conversion result missing page array:\",","sourceCodeStart":754,"sourceCodeEnd":790,"githubUrl":"https://github.com/Stirling-Tools/Stirling-PDF/blob/9ef20dcab80b85041912f045e17a6aea1d08f969/frontend/editor/src/core/tools/pdfTextEditor/PdfTextEditor.tsx#L754-L790","documentation":"Thrown during job polling when jobStatus.complete is true AND jobStatus.error is truthy. The server-side conversion job finished but reported a failure. The error message is the server-provided jobStatus.error string, re-thrown as a new Error. This surfaces server-side conversion failures (corrupt PDF, LibreOffice crash, out of memory) to the client.","triggerScenarios":"The uploaded PDF is corrupted, encrypted, or uses features the conversion pipeline cannot handle. The server's LibreOffice/PDFBox processing threw an exception. Server ran out of memory during conversion of a large document.","commonSituations":"Corrupt or malformed PDF structure. Password-protected PDF sent without credentials. Server resource exhaustion under concurrent load. LibreOffice conversion timeout for complex documents.","solutions":["Read the jobStatus.error message for the specific server-side failure reason.","Validate the PDF is not password-protected before sending to the text editor conversion.","Retry with a smaller or simplified version of the document.","Check server logs for the underlying conversion exception (LibreOffice, PDFBox stack trace)."],"exampleFix":"// before\nif (jobStatus.error) {\n  console.error(\"Job failed:\", jobStatus.error);\n  throw new Error(jobStatus.error);\n}\n\n// after\nif (jobStatus.error) {\n  console.error(\"Job failed:\", jobStatus.error);\n  throw new Error(\n    `Conversion failed: ${jobStatus.error}. The PDF may be corrupted or use unsupported features.`\n  );\n}","handlingStrategy":"try-catch","validationCode":"// Before submitting, validate the PDF is not encrypted\nif (await isPdfEncrypted(file)) {\n  setErrorMessage('This PDF is password-protected. Please unlock it first.');\n  return;\n}","typeGuard":"function isJobError(status: unknown): status is { complete: true; error: string } {\n  return typeof status === 'object' && status !== null &&\n    (status as any).complete === true && typeof (status as any).error === 'string';\n}","tryCatchPattern":"try {\n  // ... polling loop ...\n  if (jobStatus.complete && jobStatus.error) {\n    throw new Error(`Conversion failed: ${jobStatus.error}`);\n  }\n} catch (error) {\n  setErrorMessage(\n    error instanceof Error && error.message.includes('Conversion failed')\n      ? error.message\n      : 'An unexpected error occurred during conversion.'\n  );\n}","preventionTips":["Validate the PDF is not corrupted or encrypted before conversion.","Check server resource availability (CPU, memory, disk) for large documents.","Surface the server-provided error message to the user — it often contains the root cause.","Monitor server-side conversion failure rates to catch systemic issues."],"tags":["pdf-text-editor","job-polling","server-error","conversion","libreoffice"],"backgroundTag":null,"analyzedSha":"9ef20dcab80b85041912f045e17a6aea1d08f969","analyzedAt":"2026-08-13T22:11:39.827Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}