FlowiseAI/Flowise · error · Error

Error loading file

Error message

Error loading file

What it means

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.

Source

Thrown at packages/components/nodes/documentloaders/File/File.ts:384

        if (Object.keys(loaders).length === 0) {
            throw new Error('Must provide at least one loader')
        }
    }

    public async load(): Promise<Document[]> {
        const documents: Document[] = []

        for (const fileBlob of this.fileBlobs) {
            const loaderFactory = this.loaders[fileBlob.ext]
            if (loaderFactory) {
                const loader = loaderFactory(fileBlob.blob)
                documents.push(...(await loader.load()))
            } else {
                const loader = new TextLoader(fileBlob.blob)
                try {
                    documents.push(...(await loader.load()))
                } catch (error) {
                    throw new Error(`Error loading file`)
                }
            }
        }

        return documents
    }
}

module.exports = { nodeClass: File_DocumentLoaders }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Register a dedicated loader for the file's extension, or convert the file to a supported format before upload.
  2. Lowercase the extension when looking up the factory so '.PDF' matches a '.pdf' key.
  3. Improve the catch to preserve the cause: throw new Error(`Error loading file ${fileBlob.ext}: ${error.message}`, { cause: error }).
  4. Verify the Blob is non-empty before it reaches MultiFileLoader.

Example fix

// before
try {
  documents.push(...(await loader.load()))
} catch (error) {
  throw new Error(`Error loading file`)
}
// after - preserve cause and context
try {
  documents.push(...(await loader.load()))
} catch (error) {
  throw new Error(`Error loading .${fileBlob.ext} file: ${error instanceof Error ? error.message : String(error)}`, { cause: error })
}
Defensive patterns

Strategy: try-catch

Validate before calling

function assertNonEmptyBlob(blob: Blob): void {
  if (blob == null) throw new Error('File blob is null/undefined')
  if (typeof blob.size === 'number' && blob.size === 0) throw new Error('File blob is empty (0 bytes)')
}
// for (const fb of fileBlobs) assertNonEmptyBlob(fb.blob)

Try / catch

try {
  documents.push(...(await loader.load()))
} catch (error) {
  const reason = error instanceof Error ? error.message : String(error)
  // original error is swallowed upstream; re-surface by inspecting blob.ext
  throw new Error(`Failed to load .${fileBlob.ext} via TextLoader fallback: ${reason}`)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/799e7eb35ffeac07. Report an issue: GitHub.