{"record":{"id":"799e7eb35ffeac07","repo":"FlowiseAI/Flowise","slug":"error-loading-file","errorCode":null,"errorMessage":"Error loading file","messagePattern":"Error loading file","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/documentloaders/File/File.ts","lineNumber":384,"sourceCode":"        if (Object.keys(loaders).length === 0) {\n            throw new Error('Must provide at least one loader')\n        }\n    }\n\n    public async load(): Promise<Document[]> {\n        const documents: Document[] = []\n\n        for (const fileBlob of this.fileBlobs) {\n            const loaderFactory = this.loaders[fileBlob.ext]\n            if (loaderFactory) {\n                const loader = loaderFactory(fileBlob.blob)\n                documents.push(...(await loader.load()))\n            } else {\n                const loader = new TextLoader(fileBlob.blob)\n                try {\n                    documents.push(...(await loader.load()))\n                } catch (error) {\n                    throw new Error(`Error loading file`)\n                }\n            }\n        }\n\n        return documents\n    }\n}\n\nmodule.exports = { nodeClass: File_DocumentLoaders }\n","sourceCodeStart":366,"sourceCodeEnd":394,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/documentloaders/File/File.ts#L366-L394","documentation":"When MultiFileLoader has no registered factory for a file's extension, it falls back to TextLoader. If TextLoader.load() rejects, the original error is swallowed and replaced with the generic 'Error loading file' with no context about why. This makes diagnosis very hard.","triggerScenarios":"A binary or non-text file (image, archive, encrypted PDF) reaches the fallback because no specific loader is registered for its extension; the Blob is empty or corrupt; encoding detection fails; the extension was upper-case and did not match a registered lower-case key.","commonSituations":"User uploads a .heic, .odt, or other unsupported extension that has no dedicated loader; a .pdf with a stripped/corrupt xref table that TextLoader cannot read; case-sensitive extension mismatch.","solutions":["Register a dedicated loader for the file's extension, or convert the file to a supported format before upload.","Lowercase the extension when looking up the factory so '.PDF' matches a '.pdf' key.","Improve the catch to preserve the cause: throw new Error(`Error loading file ${fileBlob.ext}: ${error.message}`, { cause: error }).","Verify the Blob is non-empty before it reaches MultiFileLoader."],"exampleFix":"// before\ntry {\n  documents.push(...(await loader.load()))\n} catch (error) {\n  throw new Error(`Error loading file`)\n}\n// after - preserve cause and context\ntry {\n  documents.push(...(await loader.load()))\n} catch (error) {\n  throw new Error(`Error loading .${fileBlob.ext} file: ${error instanceof Error ? error.message : String(error)}`, { cause: error })\n}","handlingStrategy":"try-catch","validationCode":"function assertNonEmptyBlob(blob: Blob): void {\n  if (blob == null) throw new Error('File blob is null/undefined')\n  if (typeof blob.size === 'number' && blob.size === 0) throw new Error('File blob is empty (0 bytes)')\n}\n// for (const fb of fileBlobs) assertNonEmptyBlob(fb.blob)","typeGuard":null,"tryCatchPattern":"try {\n  documents.push(...(await loader.load()))\n} catch (error) {\n  const reason = error instanceof Error ? error.message : String(error)\n  // original error is swallowed upstream; re-surface by inspecting blob.ext\n  throw new Error(`Failed to load .${fileBlob.ext} via TextLoader fallback: ${reason}`)\n}","preventionTips":["Register a dedicated loader for the file's extension before upload.","Lowercase extensions when looking up the factory (case mismatch triggers the TextLoader fallback).","Reject empty blobs upstream so TextLoader never receives a 0-byte input."],"tags":["file","parsing","error-handling","file-loader"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}