{"record":{"id":"005ca851b75ba548","repo":"HKUDS/Vibe-Trading","slug":"missinginputerror-missing-model","errorCode":null,"errorMessage":"MissingInputError(missing, model)","messagePattern":"MissingInputError\\(missing, model\\)","errorType":"exception","errorClass":"MissingInputError","httpStatus":null,"severity":"error","filePath":"agent/src/quantlib/valuation/contracts.py","lineNumber":135,"sourceCode":"\n    Args:\n        supplied: The inputs the caller provided.\n        required: Field names the model cannot run without.\n        model: Name used in the error message.\n\n    Raises:\n        MissingInputError: If any required field is absent or unusable, naming\n            all of them.\n    \"\"\"\n    missing = [\n        field\n        for field in required\n        if field not in supplied\n        or supplied[field] is None\n        or (isinstance(supplied[field], str) and not supplied[field].strip())\n    ]\n    if missing:\n        raise MissingInputError(missing, model)\n\n\ndef require_positive(value: float, name: str, model: str) -> float:\n    \"\"\"Check a value that is meaningless at or below zero.\n\n    Args:\n        value: The value to check, e.g. a share count or a discount rate.\n        name: Field name for the error message.\n        model: Model name for the error message.\n\n    Returns:\n        ``value`` as a float.\n\n    Raises:\n        ValuationError: If the value is not a finite number greater than zero.\n    \"\"\"\n    try:\n        numeric = float(value)","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/quantlib/valuation/contracts.py#L117-L153","documentation":"require_inputs raises MissingInputError when any required field is absent from the supplied mapping, is None, or is a blank string. It is the central guard used by calendarise_metric, enterprise_value, equity_value_from_enterprise_value, run_dcf and project_three_statement against partially-supplied inputs.","triggerScenarios":"Calling any of those APIs with an inputs/mapping dict missing a required key, having None for it, or '' — e.g. run_dcf(inputs) where 'discount_rate' was never inserted.","commonSituations":"Optional-chained data assembly that silently leaves keys absent; conditional population of dicts; upstream API fields returning null; refactors renaming keys but not the required list.","solutions":["Read the error's missing tuple — it names exactly which fields are lacking; supply them.","Log supplied keys vs the required list at debug level in your wrapper.","Normalize your input builder: never insert None/'' for required fields; fail at assembly time instead."],"exampleFix":"# before\ninputs = {'free_cash_flow': fcf}  # forgot discount_rate\nrun_dcf(inputs, ...)\n\n# after\nrequired = {'free_cash_flow', 'discount_rate', 'terminal_growth_rate'}\nassert required <= inputs.keys() and all(inputs[k] is not None for k in required)\nrun_dcf(inputs, ...)","handlingStrategy":"try-catch","validationCode":"missing = [f for f in required if f not in inputs or inputs[f] is None or (isinstance(inputs[f], str) and not inputs[f].strip())]\nif missing:\n    raise ValueError(f'missing required inputs: {missing}')","typeGuard":null,"tryCatchPattern":"from quantlib.valuation.contracts import MissingInputError\ntry:\n    run_dcf(inputs, ...)\nexcept MissingInputError as e:\n    prompt_user_for(e.missing)  # e.missing names the fields","preventionTips":["Build input dicts unconditionally and assert required keys","Log inputs.keys() before model calls in debug mode"],"tags":["valuation","missing-input","validation","required-fields"],"backgroundTag":"missing-required-field","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}