FlowiseAI/Flowise · error · Error

Must provide at least one loader

Error message

Must provide at least one loader

What it means

MultiFileLoader constructor asserts that the per-extension loader map is non-empty. This is a programming/contract error by the caller wiring up File_DocumentLoaders, not an end-user input error. If no extension->loader factory is registered, the loader would silently fall back to TextLoader for everything, which the constructor forbids.

Source

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

    }

    if (processRaw) {
        return files.length ? JSON.stringify(files) : ''
    }

    return files.length ? `FILE-STORAGE::${JSON.stringify(files)}` : ''
}

interface LoadersMapping {
    [extension: string]: (blob: Blob) => BaseDocumentLoader
}

class MultiFileLoader extends BaseDocumentLoader {
    constructor(public fileBlobs: { blob: Blob; ext: string }[], public loaders: LoadersMapping) {
        super()

        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`)
                }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Inspect the caller in File_DocumentLoaders.init and confirm the loaders object passed to MultiFileLoader has at least one extension key.
  2. Ensure required loader imports (Pdf, Docx, Csv, etc.) are not tree-shaken away.
  3. Add a unit test asserting the mapping is populated before constructing MultiFileLoader.
Defensive patterns

Strategy: validation

Validate before calling

function assertLoadersMapping(loaders: Record<string, unknown>): void {
  const keys = Object.keys(loaders)
  if (keys.length === 0) throw new Error('MultiFileLoader requires at least one extension->loader entry')
  for (const k of keys) {
    if (typeof loaders[k] !== 'function') throw new Error(`loaders['${k}'] must be a factory function`)
  }
}
// assertLoadersMapping(loaders) before new MultiFileLoader(fileBlobs, loaders)

Type guard

function isLoadersMapping(v: unknown): v is Record<string, (b: Blob) => unknown> {
  if (typeof v !== 'object' || v === null) return false
  const entries = Object.entries(v)
  if (entries.length === 0) return false
  return entries.every(([, fn]) => typeof fn === 'function')
}

Prevention

When it happens

Trigger: File_DocumentLoaders was instantiated with an empty loaders mapping; a refactor pruned all registered extensions; the mapping was built dynamically and a filter removed every entry.

Common situations: Code change that accidentally passes {} as the loaders argument; conditional registration logic evaluated false for every extension at runtime.

Related errors


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