{"record":{"id":"3e1c5ec36ddf864f","repo":"transloadit/uppy","slug":"could-not-extract-blob-probably-an-old-browser","errorCode":null,"errorMessage":"could not extract blob, probably an old browser","messagePattern":"could not extract blob, probably an old browser","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/@uppy/thumbnail-generator/src/index.ts","lineNumber":74,"sourceCode":"  if (canvas.toBlob) {\n    return new Promise<Blob | null>((resolve) => {\n      canvas.toBlob(resolve, type, quality)\n    }).then((blob) => {\n      if (blob === null) {\n        throw new Error(\n          'cannot read image, probably an svg with external resources',\n        )\n      }\n      return blob\n    })\n  }\n  return Promise.resolve()\n    .then(() => {\n      return dataURItoBlob(canvas.toDataURL(type, quality), {})\n    })\n    .then((blob) => {\n      if (blob === null) {\n        throw new Error('could not extract blob, probably an old browser')\n      }\n      return blob\n    })\n}\n\nfunction rotateImage(image: HTMLImageElement, translate: Rotation) {\n  let w = image.width\n  let h = image.height\n\n  if (translate.deg === 90 || translate.deg === 270) {\n    w = image.height\n    h = image.width\n  }\n\n  const canvas = document.createElement('canvas')\n  canvas.width = w\n  canvas.height = h\n","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/transloadit/uppy/blob/5d4dedd02a1ac0ae022c75c54aca76558f88e256/packages/@uppy/thumbnail-generator/src/index.ts#L56-L92","documentation":"Fallback path in canvasToBlob for browsers lacking canvas.toBlob: it converts via canvas.toDataURL + dataURItoBlob, and if that yields null the blob could not be extracted. The message attributes it to an 'old browser' since only legacy engines take this branch.","triggerScenarios":"createThumbnail running in a browser without canvas.toBlob where dataURItoBlob returns null (unparseable data URL, e.g. 'data:,' produced for a tainted canvas).","commonSituations":"Legacy WebViews (old Android, embedded browsers, enterprise kiosk builds); the same tainting conditions as 132 but on the fallback code path.","solutions":["Detect lack of canvas.toBlob up front and disable the ThumbnailGenerator plugin for that environment","Test on the actual embedded WebView and plan a polyfill (e.g. toBlob polyfill via toDataURL)","Catch thumbnail errors and provide a generic file-type icon instead","Upgrade the embedded browser/WebView where possible"],"exampleFix":"// before\nnew ThumbnailGenerator(uppy) // old WebView -> 'could not extract blob, probably an old browser'\n\n// after\nif (typeof HTMLCanvasElement.prototype.toBlob === 'function') {\n  uppy.use(ThumbnailGenerator, { thumbnailWidth: 200 })\n}","handlingStrategy":"type-guard","validationCode":"const supportsCanvasToBlob =\n  typeof HTMLCanvasElement.prototype.toBlob === 'function'\nif (supportsCanvasToBlob) uppy.use(ThumbnailGenerator, { thumbnailWidth: 200 })","typeGuard":"const canGenerateThumbnails = (): boolean =>\n  typeof HTMLCanvasElement !== 'undefined' &&\n  typeof HTMLCanvasElement.prototype.toBlob === 'function'","tryCatchPattern":"try { await plugin.requestThumbnail(file) }\ncatch (err) { if (/old browser/.test(err.message)) useFallbackIcon(file) }","preventionTips":["Feature-detect canvas.toBlob before enabling the plugin","Ship a toBlob polyfill for legacy WebViews","Test embedded browsers, not just desktop Chrome"],"tags":["thumbnail-generator","legacy-browser","polyfill","canvas"],"backgroundTag":"legacy-browser-api-missing","analyzedSha":"5d4dedd02a1ac0ae022c75c54aca76558f88e256","analyzedAt":"2026-08-28T12:18:41.267Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}