{"record":{"id":"7e644ddd9c7e9509","repo":"mozilla/pdf.js","slug":"unable-to-load-this-errorstr-kind-data-at","errorCode":null,"errorMessage":"Unable to load ${this.#errorStr[kind]} data at: ${url}","messagePattern":"Unable to load (.+?) data at: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/display/binary_data_factory.js","lineNumber":54,"sourceCode":"  }\n\n  async fetch({ kind, filename }) {\n    switch (kind) {\n      case \"cMapUrl\":\n      case \"standardFontDataUrl\":\n      case \"wasmUrl\":\n        break;\n      default:\n        unreachable(`Not implemented: ${kind}`);\n    }\n    const baseUrl = this[kind];\n    if (!baseUrl) {\n      throw new Error(`Ensure that the \\`${kind}\\` API parameter is provided.`);\n    }\n    const url = `${baseUrl}${filename}`;\n\n    return this._fetch(url, kind).catch(reason => {\n      throw new Error(`Unable to load ${this.#errorStr[kind]} data at: ${url}`);\n    });\n  }\n\n  /**\n   * @ignore\n   * @returns {Promise<Uint8Array>}\n   */\n  async _fetch(url, kind) {\n    unreachable(\"Abstract method `_fetch` called.\");\n  }\n}\n\nclass DOMBinaryDataFactory extends BaseBinaryDataFactory {\n  /**\n   * @ignore\n   */\n  async _fetch(url, kind) {\n    const type =","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/display/binary_data_factory.js#L36-L72","documentation":"Thrown by BaseBinaryDataFactory.fetch when the underlying _fetch(url, kind) call rejects. The wrapper swallows the original reason and rethrows a generic 'Unable to load <CMap|font|wasm> data at: <url>' message. It indicates the resource URL was constructed but the network/CORS/HTTP request failed.","triggerScenarios":"404 for a missing CMap or font metrics file; CORS rejection when the asset host lacks Access-Control-Allow-Origin; offline/network failure; misconfigured cMapUrl/standardFontDataUrl/wasmUrl base.","commonSituations":"CDN mis-routes after a version bump (asset path changed); dev server not serving the /cmaps folder; cross-origin requests in browsers without proper CORS headers; self-hosted assets behind auth.","solutions":["Open the printed URL in a browser and confirm it returns 200 with correct CORS headers.","Verify the cMapUrl/standardFontDataUrl/wasmUrl base path matches the installed pdfjs-dist version.","If cross-origin, add Access-Control-Allow-Origin on the asset host, or host the assets same-origin."],"exampleFix":"// before (broken path)\ngetDocument({ data, cMapUrl: 'https://cdn.example.com/cmaps/' });\n\n// after\ngetDocument({ data, cMapUrl: '/assets/pdfjs/cmaps/' });\n// ensure /assets/pdfjs/cmaps/ is served and same-origin","handlingStrategy":"try-catch","validationCode":"async function assertAssetReachable(baseUrl, probeFile) {\n  const r = await fetch(baseUrl + probeFile, { method: 'HEAD' });\n  if (!r.ok) throw new Error(`Asset unreachable: ${baseUrl}${probeFile} -> ${r.status}`);\n}\n// at startup:\nawait assertAssetReachable(config.cMapUrl, 'GBK-EUC-H.bcmap');","typeGuard":"null","tryCatchPattern":"try {\n  await render();\n} catch (e) {\n  if (/Unable to load (CMap|font|wasm) data at/.test(e.message)) {\n    // log the URL and surface a config error to the user\n  } else throw e;\n}","preventionTips":["Host cmaps/standard_fonts same-origin to avoid CORS.","Pin asset paths to the installed pdfjs-dist version.","Add a startup health-check fetch against one known asset."],"tags":["network","cmaps","fonts","cors"],"backgroundTag":null,"analyzedSha":"5903d58d58e4dd9ce6ffa3834aea8480f06b4ada","analyzedAt":"2026-08-13T02:28:27.364Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}