FlowiseAI/Flowise · error · Error
Column ${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.
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)
Solutions
- Print the resolved fields (Papa meta.fields) and match the column name exactly, including case and whitespace.
- If passing a numeric index, remember it is 0-based and must be within fields.length.
- 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
- Print Papa meta.fields during development to see the exact header names.
- Trim header names before comparison to avoid whitespace mismatches.
- Use 0-based numeric indices within fields.length.
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
- Unable to resolve fields from header.
- Invalid JSON in the Chat NVIDIA NIM's baseOptions: ${excepti
- Invalid JSON in the OpenAIEmbedding's BaseOptions:
- Invalid JSON in the ChatOpenAI's BaseOptions:
- Invalid JSON in the OpenAI's BaseOptions:
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/1f37e4d8ec71e908.
Report an issue: GitHub.