datawhalechina/hello-agents · error · ValueError
Selected table_id '{requested_table_id}' does not contain an
Error message
Selected table_id '{requested_table_id}' does not contain any numeric columns and cannot be analyzed. What it means
Raised by the PDF document-ingestion pipeline when the caller explicitly selects a table via selected_table_id, but that table's extracted schema contains zero numeric columns. The pipeline can only run statistical analysis on numeric data, so it refuses up front with a ValueError instead of producing an empty analysis. It is distinct from the sibling error for a table_id that does not exist at all.
Source
Thrown at Co-creation-projects/healer-666-Academic-Data-Agent/src/data_analysis_agent/document_ingestion.py:355
parsed_document_path = (data_dir / "parsed_document.json").resolve()
full_text, records = _extract_pdf_payload(
source_path,
max_pdf_pages=max_pdf_pages,
max_candidate_tables=max_candidate_tables,
extracted_tables_dir=extracted_tables_dir,
)
background_literature_context = _extract_background_context(full_text)
requested_table_id = str(selected_table_id or "").strip()
requested_record = None
if requested_table_id:
requested_record = next((record for record in records if record.table_id == requested_table_id), None)
if requested_record is None:
raise ValueError(
f"Selected table_id '{requested_table_id}' was not found in the extracted candidate tables."
)
if not requested_record.numeric_columns:
raise ValueError(
f"Selected table_id '{requested_table_id}' does not contain any numeric columns and cannot be analyzed."
)
primary_record = requested_record or _select_primary_table(records)
warnings: list[str] = []
if primary_record is None:
summary = (
"PDF 解析失败:未提取到满足主表路由规则的结构化表格。"
"V1 暂不支持复杂多表路由或扫描件恢复,请手动裁剪 PDF 或改上传目标表格。"
)
parsed_payload = _serialize_parsed_document(
source_pdf=source_path,
background_literature_context=background_literature_context,
full_text_excerpt=full_text[:2000],
selected_table_id="",
records=records,
)
parsed_document_path.parent.mkdir(parents=True, exist_ok=True)View on GitHub (pinned to 606a07d341)
Solutions
- Pick a different selected_table_id from the candidate records that do have numeric columns (inspect record.numeric_columns for each extracted record).
- Omit selected_table_id and let _select_primary_table auto-route to a table with numeric data.
- If the target table genuinely holds numbers, fix the source PDF or extraction so numeric cells are recognized (cleaner PDF export, remove currency/unit symbols from cells, or improve the numeric-coercion step).
- Manually crop the PDF to just the target table, as the pipeline's own failure summary suggests for complex multi-table documents.
Example fix
# before result = ingest_and_analyze(pdf_path, selected_table_id="table_03") # table_03 is text-only # after numeric_ids = [r.table_id for r in records if r.numeric_columns] result = ingest_and_analyze(pdf_path, selected_table_id=numeric_ids[0]) if numeric_ids else ingest_and_analyze(pdf_path)
Defensive patterns
Strategy: validation
Validate before calling
# Before passing selected_table_id
record = next((r for r in records if r.table_id == wanted_id), None)
if record is not None and not record.numeric_columns:
raise SystemExit(f"table {wanted_id} has no numeric columns; pick one of "
f"{[r.table_id for r in records if r.numeric_columns]}") Type guard
def is_analyzable(record) -> bool:
return record is not None and bool(record.numeric_columns) Try / catch
try:
ingest(pdf, selected_table_id=table_id)
except ValueError as e:
if "does not contain any numeric columns" in str(e):
table_id = next(r.table_id for r in records if r.numeric_columns) # fallback pick
ingest(pdf, selected_table_id=table_id)
else:
raise Prevention
- Surface each candidate table's numeric_columns to the user before they choose a table_id.
- Auto-filter candidate tables to those with at least one numeric column.
- Add a UI hint that non-numeric tables cannot be analyzed.
When it happens
Trigger: Calling the ingestion/analysis function with selected_table_id pointing at an extracted table whose numeric_columns list is empty — e.g. a table of pure text labels, a header-only fragment, or a table where every numeric cell failed type coercion during extraction.
Common situations: PDFs with many tables where the user picks the wrong table_id; scanned or garbled PDFs where numbers are OCR'd as text; tables whose 'numeric' columns are formatted with currency symbols/units that defeat the numeric detector; multi-page PDFs where caption tables get extracted as candidates.
Related errors
- 影片不存在或已下架
- Selected table_id '{requested_table_id}' was not found in th
- 工具 '{tool_name}' 不存在
- 工具 '{tool_name}' 执行超时
- 工具 '{tool_name}' 执行失败: {str(e)}
AI-assisted analysis of datawhalechina/hello-agents@606a07d341 (2026-08-14).
Data as JSON: /api/errors/ddd537f5914c69c1.
Report an issue: GitHub.