{"record":{"id":"ddd537f5914c69c1","repo":"datawhalechina/hello-agents","slug":"selected-table-id-requested-table-id-does-not","errorCode":null,"errorMessage":"Selected table_id '{requested_table_id}' does not contain any numeric columns and cannot be analyzed.","messagePattern":"Selected table_id '(.+?)' does not contain any numeric columns and cannot be analyzed\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"Co-creation-projects/healer-666-Academic-Data-Agent/src/data_analysis_agent/document_ingestion.py","lineNumber":355,"sourceCode":"    parsed_document_path = (data_dir / \"parsed_document.json\").resolve()\n\n    full_text, records = _extract_pdf_payload(\n        source_path,\n        max_pdf_pages=max_pdf_pages,\n        max_candidate_tables=max_candidate_tables,\n        extracted_tables_dir=extracted_tables_dir,\n    )\n    background_literature_context = _extract_background_context(full_text)\n    requested_table_id = str(selected_table_id or \"\").strip()\n    requested_record = None\n    if requested_table_id:\n        requested_record = next((record for record in records if record.table_id == requested_table_id), None)\n        if requested_record is None:\n            raise ValueError(\n                f\"Selected table_id '{requested_table_id}' was not found in the extracted candidate tables.\"\n            )\n        if not requested_record.numeric_columns:\n            raise ValueError(\n                f\"Selected table_id '{requested_table_id}' does not contain any numeric columns and cannot be analyzed.\"\n            )\n    primary_record = requested_record or _select_primary_table(records)\n    warnings: list[str] = []\n\n    if primary_record is None:\n        summary = (\n            \"PDF 解析失败：未提取到满足主表路由规则的结构化表格。\"\n            \"V1 暂不支持复杂多表路由或扫描件恢复，请手动裁剪 PDF 或改上传目标表格。\"\n        )\n        parsed_payload = _serialize_parsed_document(\n            source_pdf=source_path,\n            background_literature_context=background_literature_context,\n            full_text_excerpt=full_text[:2000],\n            selected_table_id=\"\",\n            records=records,\n        )\n        parsed_document_path.parent.mkdir(parents=True, exist_ok=True)","sourceCodeStart":337,"sourceCodeEnd":373,"githubUrl":"https://github.com/datawhalechina/hello-agents/blob/606a07d341a47be773fab7f4b71177f53f96b2c3/Co-creation-projects/healer-666-Academic-Data-Agent/src/data_analysis_agent/document_ingestion.py#L337-L373","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nresult = ingest_and_analyze(pdf_path, selected_table_id=\"table_03\")  # table_03 is text-only\n\n# after\nnumeric_ids = [r.table_id for r in records if r.numeric_columns]\nresult = ingest_and_analyze(pdf_path, selected_table_id=numeric_ids[0]) if numeric_ids else ingest_and_analyze(pdf_path)","handlingStrategy":"validation","validationCode":"# Before passing selected_table_id\nrecord = next((r for r in records if r.table_id == wanted_id), None)\nif record is not None and not record.numeric_columns:\n    raise SystemExit(f\"table {wanted_id} has no numeric columns; pick one of \"\n                     f\"{[r.table_id for r in records if r.numeric_columns]}\")","typeGuard":"def is_analyzable(record) -> bool:\n    return record is not None and bool(record.numeric_columns)","tryCatchPattern":"try:\n    ingest(pdf, selected_table_id=table_id)\nexcept ValueError as e:\n    if \"does not contain any numeric columns\" in str(e):\n        table_id = next(r.table_id for r in records if r.numeric_columns)  # fallback pick\n        ingest(pdf, selected_table_id=table_id)\n    else:\n        raise","preventionTips":["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."],"tags":["data-validation","pdf-parsing","table-extraction","python"],"backgroundTag":null,"analyzedSha":"606a07d341a47be773fab7f4b71177f53f96b2c3","analyzedAt":"2026-08-14T22:57:27.446Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}