{"record":{"id":"853314c9d5564fb3","repo":"transloadit/uppy","slug":"file-data-is-empty-853314","errorCode":null,"errorMessage":"File data is empty","messagePattern":"File data is empty","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@uppy/tus/src/index.ts","lineNumber":487,"sourceCode":"      const allowedMetaFields = getAllowedMetaFields(\n        opts.allowedMetaFields,\n        file.meta,\n      )\n      allowedMetaFields.forEach((item) => {\n        // tus type definition for metadata only accepts `Record<string, string>`\n        // but in reality (at runtime) it accepts `Record<string, unknown>`\n        // tus internally converts everything into a string, but let's do it here instead to be explicit.\n        // because Uppy can have anything inside meta values, (for example relativePath: null is often sent by uppy)\n        meta[item] = String(file.meta[item])\n      })\n\n      // tusd uses metadata fields 'filetype' and 'filename'\n      copyProp(meta, 'type', 'filetype')\n      copyProp(meta, 'name', 'filename')\n\n      uploadOptions.metadata = meta\n\n      if (file.data == null) throw new Error('File data is empty')\n      upload = new tus.Upload(file.data, uploadOptions)\n      this.uploaders[file.id] = upload\n      const eventManager = new EventManager(this.uppy)\n      this.uploaderEvents[file.id] = eventManager\n\n      qRequest = () => {\n        if (!file.isPaused) {\n          upload.start()\n        }\n        // Don't do anything here, the caller will take care of cancelling the upload itself\n        // using #resetUploaderReferences(). This is because #resetUploaderReferences() has to be\n        // called when this request is still in the queue, and has not been started yet, too. At\n        // that point this cancellation function is not going to be called.\n        // Also, we need to remove the request from the queue _without_ destroying everything\n        // related to this upload to handle pauses.\n        return () => {}\n      }\n","sourceCodeStart":469,"sourceCodeEnd":505,"githubUrl":"https://github.com/transloadit/uppy/blob/5d4dedd02a1ac0ae022c75c54aca76558f88e256/packages/@uppy/tus/src/index.ts#L469-L505","documentation":"#uploadLocalFile throws when constructing a tus.Upload because file.data is null/undefined. The Tus uploader needs the raw Blob/File bytes to upload, so an empty or missing data field cannot proceed.","triggerScenarios":"Uploading a file whose uppy file object has data == null — e.g. files added with only metadata, restored files whose data was not reattached, or remote/provider files being fed to Tus without importFromUploadURLs.","commonSituations":"Using Golden Retriever restoration without restoring file blobs; adding files via uppy.addFile({ name, type }) with no data; sending provider files (Google Drive etc.) to Tus instead of Companion-based upload.","solutions":["Ensure uppy.addFile is always called with a real File/Blob in data","If restoring files with Golden Retriever, re-attach data before upload or use @uppy/store-Cloudinary/restore mechanisms that preserve blobs","For remote provider files, use Transloadit/Companion importFromUploadURLs or XHR upload with a Companion-proxied URL rather than Tus directly"],"exampleFix":"// before\nuppy.addFile({ name: 'a.jpg', type: 'image/jpeg' }) // no data\n// after\nuppy.addFile({ name: file.name, type: file.type, data: file }) // real File","handlingStrategy":"type-guard","validationCode":"for (const f of uppy.getFiles()) {\n  if (f.data == null) uppy.removeFile(f.id)\n}","typeGuard":"const hasData = (file: { data?: unknown }): boolean => file.data instanceof Blob || typeof ArrayBuffer.isView(file.data) === 'boolean' && ArrayBuffer.isView(file.data)","tryCatchPattern":null,"preventionTips":["Always pass a real File/Blob in addFile data","Test restoration flows (Golden Retriever) before relying on them","Don't route remote provider files straight to Tus"],"tags":["tus","file-data","missing-blob","upload"],"backgroundTag":"missing-required-argument","analyzedSha":"5d4dedd02a1ac0ae022c75c54aca76558f88e256","analyzedAt":"2026-08-28T12:18:41.267Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}