stanford-oval/storm · error · ValueError
Content column {content_column} not found in the csv file.
Error message
Content column {content_column} not found in the csv file. What it means
After reading the CSV with pandas, the requested content_column is not among df.columns. The header-based lookups are case- and whitespace-sensitive, so even similar names fail.
Source
Thrown at knowledge_storm/utils.py:245
qdrant = QdrantVectorStoreManager._init_offline_vector_db(
vector_store_path=vector_store_path,
collection_name=collection_name,
model=model,
)
else:
raise ValueError(
"Invalid vector_db_mode. Please provide either 'online' or 'offline'."
)
if qdrant is None:
raise ValueError("Qdrant client is not initialized.")
# read the csv file
import pandas as pd
df = pd.read_csv(file_path)
# check that content column exists and url column exists
if content_column not in df.columns:
raise ValueError(
f"Content column {content_column} not found in the csv file."
)
if url_column not in df.columns:
raise ValueError(f"URL column {url_column} not found in the csv file.")
documents = [
Document(
page_content=row[content_column],
metadata={
"title": row.get(title_column, ""),
"url": row[url_column],
"description": row.get(desc_column, ""),
},
)
for row in df.to_dict(orient="records")
]
# split the documentsView on GitHub (pinned to fb951af774)
Solutions
- Inspect df.columns (e.g. print(list(df.columns))) and match the exact string
- Load with encoding='utf-8-sig' to strip BOM, or normalize headers: df.columns = df.columns.str.strip()
- Regenerate the CSV with the expected header if the column is truly absent
Example fix
# before
df = pd.read_csv('d.csv')
create_or_update_vector_store('c', 'offline', 'd.csv', 'Content', 'url')
# after
df = pd.read_csv('d.csv', encoding='utf-8-sig')
df.columns = df.columns.str.strip()
df.to_csv('d.csv', index=False)
create_or_update_vector_store('c', 'offline', 'd.csv', 'content', 'url') Defensive patterns
Strategy: validation
Validate before calling
import pandas as pd
df = pd.read_csv(file_path, nrows=0)
df.columns = df.columns.str.strip()
assert content_column in df.columns, f'{content_column!r} not in {list(df.columns)}' Type guard
def content_column_exists(csv_path: str, col: str) -> bool:
import pandas as pd
headers = pd.read_csv(csv_path, nrows=0, encoding='utf-8-sig').columns.str.strip()
return col in headers Try / catch
try:
create_or_update_vector_store('c', mode, f, content_column, url_column, ...)
except ValueError as e:
if 'not found in the csv file' in str(e):
import pandas as pd
raise SystemExit(f'Bad column; available: {pd.read_csv(f, nrows=0).columns.tolist()}') from e
raise Prevention
- Always read CSVs with encoding='utf-8-sig' to kill Excel BOMs
- Normalize headers with df.columns.str.strip() before choosing column names
- Log available columns whenever ingestion fails on schema
When it happens
Trigger: Passing content_column='Content' when the header is 'content', a name with trailing whitespace/BOM (common with Excel-exported CSVs), or a column that simply does not exist.
Common situations: Vendor CSVs with BOM-prefixed first header (pd.read_csv yields '\ufeffcontent'), renamed headers, or dialect differences between the exporting and ingesting teams.
Related errors
- Please provide the name of the content column.
- Please provide the name of the url column.
- Please provide a file path.
- Not valid file format. Please provide a csv file.
- URL column {url_column} not found in the csv file.
AI-assisted analysis of stanford-oval/storm@fb951af774 (2026-08-28).
Data as JSON: /api/errors/5c6b518159184ccc.
Report an issue: GitHub.