{"record":{"id":"e35da0eca58e9e0d","repo":"firecrawl/firecrawl","slug":"extract-job-extractstatus-status-error-extr","errorCode":null,"errorMessage":"Extract job ${extractStatus.status}. Error: ${extractStatus.error}","messagePattern":"Extract job (.+?)\\. Error: (.+?)","errorType":"exception","errorClass":"FirecrawlError","httpStatus":null,"severity":"error","filePath":"apps/js-sdk/firecrawl/src/index.backup.ts","lineNumber":1292,"sourceCode":"          const statusResponse: AxiosResponse = await this.getRequest(\n            `${this.apiUrl}/v1/extract/${jobId}`,\n            headers\n          );\n          extractStatus = statusResponse.data;\n          if (extractStatus.status === \"completed\") {\n            if (extractStatus.success) {\n              return {\n                success: true,\n                data: extractStatus.data,\n                warning: extractStatus.warning,\n                error: extractStatus.error,\n                sources: extractStatus?.sources || undefined,\n              };\n            } else {\n              throw new FirecrawlError(`Failed to extract data. Error: ${extractStatus.error}`, statusResponse.status);\n            }\n          } else if (extractStatus.status === \"failed\" || extractStatus.status === \"cancelled\") {\n            throw new FirecrawlError(`Extract job ${extractStatus.status}. Error: ${extractStatus.error}`, statusResponse.status);\n          }\n          await new Promise(resolve => setTimeout(resolve, 1000)); // Polling interval\n        } while (extractStatus.status !== \"completed\");\n      } else {\n        this.handleError(response, \"extract\");\n      }\n    } catch (error: any) {\n      throw new FirecrawlError(error.message, 500, error.response?.data?.details);\n    }\n    return { success: false, error: \"Internal server error.\"};\n  }\n\n  /**\n   * Initiates an asynchronous extract job for a URL using the Firecrawl API.\n   * @param url - The URL to extract data from.\n   * @param params - Additional parameters for the extract request.\n   * @param idempotencyKey - Optional idempotency key for the request.\n   * @returns The response from the extract operation.","sourceCodeStart":1274,"sourceCodeEnd":1310,"githubUrl":"https://github.com/firecrawl/firecrawl/blob/656bffcc2883f1af5befe38766b1ff5f0469993a/apps/js-sdk/firecrawl/src/index.backup.ts#L1274-L1310","documentation":"FirecrawlError thrown by the JS SDK's extract() when polling /v1/extract/:jobId returns status 'failed' or 'cancelled'. The message embeds the server-supplied extractStatus.error and uses the status response's HTTP status as the error's statusCode. This is a terminal extract outcome reported by the server, surfaced through the SDK.","triggerScenarios":"Client calls extract(); the server accepts the job, returns an id, and during the SDK's 1s-interval polling the job transitions to 'failed' or 'cancelled'. The SDK throws FirecrawlError('Extract job <status>. Error: <server error>', statusResponse.status).","commonSituations":"Extract schema too strict/unsatisfiable for the page content; LLM extraction model error upstream; job cancelled via API or by the system; rate-limit/resource exhaustion marking the job failed; transient model outage surfacing as a permanent 'failed'.","solutions":["Inspect err.details and extractStatus.error for the server-side cause and adjust the schema/prompt accordingly.","Loosen or simplify the extract schema and retry.","Retry the call once for transient 'failed' (e.g. upstream model hiccup), but do not retry 'cancelled' unless you re-initiated it.","Ensure the URLs provided are reachable and contain the data the schema expects.","If using prompt/systemPrompt options, verify they are valid and not empty."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate inputs before extracting\nassert(Array.isArray(urls) && urls.every(u => /^https?:/.test(u)), 'valid urls required');\nassert(!params?.schema || isValidSchema(params.schema), 'schema invalid');","typeGuard":"function isExtractTerminal(e): e is FirecrawlError {\n  return e instanceof FirecrawlError && /^Extract job (failed|cancelled)/.test(e.message);\n}","tryCatchPattern":"try { await app.extract(urls, params); }\ncatch (e) {\n  if (isExtractTerminal(e) && /cancelled/.test(e.message)) return;\n  if (isExtractTerminal(e) && attempt < 1) { await backoff(attempt); retry; }\n  else throw e;\n}","preventionTips":["Start with a loose schema and tighten iteratively.","Do not retry 'cancelled' jobs unless you re-initiated them.","Confirm target URLs contain the fields your schema expects."],"tags":["sdk","js-sdk","extract","polling","terminal-status"],"analyzedSha":"656bffcc2883f1af5befe38766b1ff5f0469993a","analyzedAt":"2026-08-12T01:18:00.488Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}