{"record":{"id":"19b4bb13d3693f2f","repo":"HKUDS/Vibe-Trading","slug":"build-three-statement-artifact-result-must-be-a-t","errorCode":null,"errorMessage":"build_three_statement_artifact: result must be a ThreeStatementProjection, got {type(result).__name__}","messagePattern":"build_three_statement_artifact: result must be a ThreeStatementProjection, got (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"agent/src/quantlib/valuation/artifact.py","lineNumber":886,"sourceCode":"        result: The :class:`ThreeStatementProjection` that call produced.\n        generated_at: Timezone-aware timestamp of the run, supplied by the\n            caller.\n        circularity_tolerance: The ``circularity_tolerance`` the call used.\n        max_circularity_iterations: The ``max_circularity_iterations`` the\n            call used.\n        balance_tolerance: The ``balance_tolerance`` the call used.\n\n    Returns:\n        A ``model_name=\"three_statement\"`` :class:`ModelArtifact`.\n\n    Raises:\n        TypeError: If ``generated_at`` is not a ``datetime``, or ``result``\n            is not a :class:`ThreeStatementProjection`.\n        ValueError: If ``generated_at`` is timezone-naive.\n    \"\"\"\n    generated_at = _require_generated_at(generated_at, \"build_three_statement_artifact\")\n    if not isinstance(result, ThreeStatementProjection):\n        raise TypeError(\n            \"build_three_statement_artifact: result must be a \"\n            f\"ThreeStatementProjection, got {type(result).__name__}\"\n        )\n\n    canonical_inputs = {\n        \"config\": {\n            \"circularity_tolerance\": circularity_tolerance,\n            \"max_circularity_iterations\": max_circularity_iterations,\n            \"balance_tolerance\": balance_tolerance,\n        },\n        \"opening\": dict(opening),\n        \"drivers\": {key: list(value) for key, value in drivers.items()},\n    }\n    hash_leaves: dict[str, str] = {}\n    readable_inputs: dict[str, Any] = {}\n    _flatten(canonical_inputs, \"$\", hash_leaves, readable_inputs, None)\n    input_hash = _hash_leaves(hash_leaves)\n","sourceCodeStart":868,"sourceCodeEnd":904,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/quantlib/valuation/artifact.py#L868-L904","documentation":"build_three_statement_artifact requires result to be a ThreeStatementProjection instance. Any other type — dict of DataFrames, a DCFResult, a legacy projection namedtuple — is a TypeError.","triggerScenarios":"build_three_statement_artifact(result={\"income\": df, ...}, ...); passing a DCFResult or an older projection class; passing the engine's raw tuple return.","commonSituations":"Upgrading the projection engine whose return type changed; copy-pasting from the DCF artifact builder; mock objects in tests that aren't subclasses.","solutions":["Pass the ThreeStatementProjection returned by the projection engine.","If you hold partial data, construct a ThreeStatementProjection explicitly.","Update mocks/fakes to subclass ThreeStatementProjection."],"exampleFix":"# before\nbuild_three_statement_artifact(result=(income_df, balance_df, cash_df), generated_at=ts)\n# after\nbuild_three_statement_artifact(result=run_three_statement(model, assumptions), generated_at=ts)","handlingStrategy":"type-guard","validationCode":"from quantlib.valuation.models import ThreeStatementProjection\nassert isinstance(result, ThreeStatementProjection)","typeGuard":"from quantlib.valuation.models import ThreeStatementProjection\ndef is_three_statement_projection(value) -> bool:\n    return isinstance(value, ThreeStatementProjection)","tryCatchPattern":null,"preventionTips":["Use the projection engine's return value unmodified.","Make test doubles subclass ThreeStatementProjection."],"tags":["python","type-validation","artifact","three-statement"],"backgroundTag":"wrong-argument-type","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}