{"record":{"id":"c4ed497fca24abd0","repo":"HKUDS/Vibe-Trading","slug":"path-row-row-number-amount-is-blank-a-missin","errorCode":null,"errorMessage":"{path} row {row_number}: amount is blank. A missing amount must be fixed at the source; it is not treated as zero.","messagePattern":"(.+?) row (.+?): amount is blank\\. A missing amount must be fixed at the source; it is not treated as zero\\.","errorType":"exception","errorClass":"CashFlowIngestError","httpStatus":null,"severity":"error","filePath":"agent/src/entities/ingest.py","lineNumber":205,"sourceCode":"    ``(1,234.50)``.\n\n    Args:\n        raw: Raw cell text.\n        path: File path, used only for error messages.\n        row_number: 1-based data row number, used only for error messages.\n        decimal_separator: Declared decimal separator, or ``None`` to infer.\n\n    Returns:\n        The parsed float, negated when the cell was parenthesised or carried a\n        trailing minus.\n\n    Raises:\n        CashFlowIngestError: If the cell is blank, not numeric, or ambiguously\n            grouped.\n    \"\"\"\n    text = (raw or \"\").strip()\n    if not text:\n        raise CashFlowIngestError(\n            f\"{path} row {row_number}: amount is blank. A missing amount must be \"\n            \"fixed at the source; it is not treated as zero.\"\n        )\n\n    negative = text.startswith(\"(\") and text.endswith(\")\")\n    if negative:\n        text = text[1:-1]\n    text = \"\".join(ch for ch in text if ch not in _AMOUNT_SYMBOLS).strip()\n    if text.endswith(\"-\"):  # trailing-minus exports\n        text = \"-\" + text[:-1]\n\n    try:\n        value = float(_to_plain_number(text, decimal_separator))\n    except ValueError as exc:\n        raise CashFlowIngestError(\n            f\"{path} row {row_number}: amount {raw!r} is not usable: {exc}\"\n        ) from exc\n    return -value if negative else value","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/entities/ingest.py#L187-L223","documentation":"Raised by _parse_amount when the amount cell is empty after stripping. The library deliberately does not treat missing amounts as zero — silently defaulting to 0 would corrupt totals — so a blank amount must be corrected in the source file or mapped away.","triggerScenarios":"load_cashflows (or load_panel via _parse_panel_amount) reads a row whose amount column cell is empty or whitespace-only, e.g. '2024-01-05,,USD'.","commonSituations":"Sparse spreadsheets where some rows leave the amount blank; header/offset misalignment after a wrong delimiter so amounts land in another column; trailing empty rows picked up by the reader; amount column mapped to the wrong header.","solutions":["Open the file at the reported row and fill in or delete the blank-amount row","Verify the delimiter and column mapping are correct so the amount column is actually the amount column","Drop trailing blank rows in the source export","If blanks are legitimately ignorable rows, filter them out of the file before loading"],"exampleFix":"# before (row: 2024-01-05,,USD)\nload_cashflows('flows.csv')\n# after (row: 2024-01-05,150.00,USD)\nload_cashflows('flows.csv')","handlingStrategy":"validation","validationCode":"blank = [i for i, r in enumerate(rows, 2) if not (r.get(amount_col) or '').strip()]\nif blank:\n    raise ValueError(f'blank amounts at rows {blank}; fix source')","typeGuard":"def has_blank_amounts(rows, amount_col) -> bool:\n    return any(not (r.get(amount_col) or '').strip() for r in rows)","tryCatchPattern":"try:\n    load_cashflows(p)\nexcept CashFlowIngestError as e:\n    if 'amount is blank' in str(e):\n        rows = drop_blank_amount_rows(read_rows(p)); rewrite(p, rows)","preventionTips":["Treat blank amounts as source defects; never coerce to 0","Run a pre-load row scan for blank required cells","Reject exports with empty amount cells at the pipeline boundary"],"tags":["csv","ingest","blank-value","cashflow"],"backgroundTag":"missing-required-field","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}