FlowiseAI/Flowise · error · Error

Column not found in CSV file.

Error message

Column ${column} not found in CSV file.

What it means

CsvLoader resolved header fields successfully but the requested column was not among them. column may be a string name or a numeric index; when numeric it is first mapped to fields[column]. If that mapped name (or the literal string) is not in fields, this throws.

Solutions

  1. Print the resolved fields (Papa meta.fields) and match the column name exactly, including case and whitespace.
  2. If passing a numeric index, remember it is 0-based and must be within fields.length.
  3. Normalize header whitespace upstream: trim each field name before comparison.

Example fix

// before
if (!fields.includes(searchIdx as string)) {
  throw new Error(`Column ${column} not found in CSV file.`)
}
// after - list available fields to aid debugging
if (!fields.includes(searchIdx as string)) {
  throw new Error(`Column ${JSON.stringify(column)} not found. Available: ${JSON.stringify(fields)}`)
}
Defensive patterns

Strategy: validation

Validate before calling

import Papa from 'papaparse'

function resolveColumn(raw: string, column: string | number, separator?: string): string {
  const { meta: { fields = [] } } = Papa.parse(raw.trim(), { delimiter: separator, header: true, preview: 1 })
  const trimmed = fields.map((f) => f.trim())
  const resolved = typeof column === 'number' ? trimmed[column] : column
  if (!trimmed.includes(typeof column === 'number' ? resolved : column.trim())) {
    throw new Error(`Column ${JSON.stringify(column)} not found. Available: ${JSON.stringify(trimmed)}`)
  }
  return resolved
}

Type guard

function columnExists(raw: string, column: string | number, separator?: string): boolean {
  const { meta: { fields = [] } } = Papa.parse(raw.trim(), { delimiter: separator, header: true, preview: 1 })
  const trimmed = fields.map((f) => f.trim())
  if (typeof column === 'number') return column >= 0 && column < trimmed.length
  return trimmed.includes(column.trim())
}

Prevention

When it happens

Trigger: User typed 'email_address' but the header is 'email'; numeric index out of range (e.g., 5 in a 3-column file maps to undefined); trailing whitespace in the header name (e.g., 'email ' vs 'email'); case mismatch.

Common situations: Schema drift between the expected and actual CSV header; column name copy-pasted from a spec but the file uses different naming; 1-based vs 0-based indexing confusion when passing a number.

Related errors


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

Appendix: source

Thrown at packages/components/nodes/documentloaders/Csv/CsvLoader.ts:65

            meta: { fields = [] }
        } = Papa.parse<{ [K: string]: string }>(raw.trim(), {
            delimiter: separator,
            header: true
        })

        if (column !== undefined) {
            if (!fields.length) {
                throw new Error(`Unable to resolve fields from header.`)
            }

            let searchIdx = column

            if (typeof column == 'number') {
                searchIdx = fields[column]
            }

            if (!fields.includes(searchIdx as string)) {
                throw new Error(`Column ${column} not found in CSV file.`)
            }

            // Note TextLoader will raise an exception if the value is null.
            return parsed.map((row) => row[searchIdx])
        }

        return parsed.map((row) => fields.map((key) => `${key.trim() || '_0'}: ${row[key]?.trim()}`).join('\n'))
    }
}

View on GitHub (pinned to abe4a8601a)