{"record":{"id":"4c3071d1c3a54a64","repo":"mozilla/pdf.js","slug":"not-implemented-networkstream","errorCode":null,"errorMessage":"Not implemented: NetworkStream","messagePattern":"Not implemented: NetworkStream","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/display/api.js","lineNumber":429,"sourceCode":"\n      const workerIdPromise = worker.messageHandler.sendWithPromise(\n        \"GetDocRequest\",\n        docParams,\n        data ? [data.buffer] : null\n      );\n\n      let networkStream;\n      if (data) {\n        // The entire PDF was provided, no `networkStream` necessary.\n      } else if (rangeTransport) {\n        networkStream = new PDFDataTransportStream({\n          pdfDataRangeTransport: rangeTransport,\n          disableRange,\n          disableStream,\n        });\n      } else if (url) {\n        if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n          throw new Error(\"Not implemented: NetworkStream\");\n        }\n        const NetworkStream = getNetworkStream(url);\n\n        networkStream = new NetworkStream({\n          url,\n          httpHeaders,\n          withCredentials,\n          rangeChunkSize,\n          disableRange,\n          disableStream,\n        });\n      } else {\n        throw new Error(\n          \"getDocument - expected either `data`, `range`, or `url` parameter.\"\n        );\n      }\n\n      return workerIdPromise.then(workerId => {","sourceCodeStart":411,"sourceCodeEnd":447,"githubUrl":"https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/display/api.js#L411-L447","documentation":"A build-configuration Error: in the MOZCENTRAL build (Firefox built-in viewer) the url-based NetworkStream code path is disabled and throws immediately. Mozilla ships its own network transport, so the generic PDF.js stream is intentionally unavailable. Only data or range transports work in MOZCENTRAL.","triggerScenarios":"Calling getDocument({ url }) from code running in the MOZCENTRAL (Firefox built-in) build instead of the GENERIC build. Triggered only when PDFJSDev.test('MOZCENTRAL') is true.","commonSituations":"Embedding pdf.js inside Firefox/XUL and accidentally using the generic API; building with the wrong target; tests that assume GENERIC but run against a MOZCENTRAL bundle.","solutions":["If you need URL loading, use the GENERIC build of pdf.js instead of MOZCENTRAL.","In MOZCENTRAL, pass data (Uint8Array) or a range transport rather than url.","Switch your gulp/webpack target to generic / use the published pdfjs-dist package."],"exampleFix":"// before (MOZCENTRAL build)\npdfjsLib.getDocument({ url }); // throws\n\n// after\nconst data = new Uint8Array(await (await fetch(url)).arrayBuffer());\npdfjsLib.getDocument({ data });","handlingStrategy":"validation","validationCode":"// Only pass `url` in builds that support it.\nif (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('MOZCENTRAL')) {\n  const data = new Uint8Array(await (await fetch(url)).arrayBuffer());\n  getDocument({ data });\n} else {\n  getDocument({ url });\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the GENERIC build when you need URL loading.","In MOZCENTRAL, always supply data or a range transport.","Document the build target your code assumes."],"tags":["build-config","mozcentral","network","getdocument"],"backgroundTag":null,"analyzedSha":"5903d58d58e4dd9ce6ffa3834aea8480f06b4ada","analyzedAt":"2026-08-13T02:28:27.364Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}