{"record":{"id":"c140edeccd424e51","repo":"microsoft/qlib","slug":"report-type-should-be-one-of-pred-long-pred-long","errorCode":null,"errorMessage":"report_type should be one of pred_long, pred_long_short, pred_short, excess_return_without_cost, excess_return_with_cost and model","messagePattern":"report_type should be one of pred_long, pred_long_short, pred_short, excess_return_without_cost, excess_return_with_cost and model","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"qlib/contrib/tuner/config.py","lineNumber":70,"sourceCode":"        self.tuner_class = config.get(\"tuner_class\", \"QLibTuner\")\n        # Save the tuner experiment for further view\n        tuner_ex_config_path = os.path.join(self.tuner_ex_dir, \"tuner_config.yaml\")\n        with open(tuner_ex_config_path, \"w\") as fp:\n            yaml.dump(TUNER_CONFIG_MANAGER.config, fp)\n\n\nclass OptimizationConfig:\n    def __init__(self, config, TUNER_CONFIG_MANAGER):\n        self.report_type = config.get(\"report_type\", \"pred_long\")\n        if self.report_type not in [\n            \"pred_long\",\n            \"pred_long_short\",\n            \"pred_short\",\n            \"excess_return_without_cost\",\n            \"excess_return_with_cost\",\n            \"model\",\n        ]:\n            raise ValueError(\n                \"report_type should be one of pred_long, pred_long_short, pred_short, excess_return_without_cost, excess_return_with_cost and model\"\n            )\n\n        self.report_factor = config.get(\"report_factor\", \"information_ratio\")\n        if self.report_factor not in [\n            \"annualized_return\",\n            \"information_ratio\",\n            \"max_drawdown\",\n            \"mean\",\n            \"std\",\n            \"model_score\",\n            \"model_pearsonr\",\n        ]:\n            raise ValueError(\n                \"report_factor should be one of annualized_return, information_ratio, max_drawdown, mean, std, model_pearsonr and model_score\"\n            )\n\n        self.optim_type = config.get(\"optim_type\", \"max\")","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/contrib/tuner/config.py#L52-L88","documentation":"OptimizationConfig (qlib/contrib/tuner/config.py) validates the report_type field of the tuner YAML. Only six report types are accepted: pred_long, pred_long_short, pred_short, excess_return_without_cost, excess_return_with_cost, and model. Anything else raises ValueError at config load time.","triggerScenarios":"A tuner YAML with optimization_criteria: report_type: long (or any unsupported/misspelled/case-different value) is loaded by TunerConfigManager; the error fires during OptimizationConfig construction.","commonSituations":"Hand-writing the tuner config and abbreviating the report type; version drift where older/newer qlib accepts a different set of report types; copy-pasting a report type from analysis-report code (e.g. 'report_long') that is not valid here.","solutions":["Set report_type to one of: pred_long, pred_long_short, pred_short, excess_return_without_cost, excess_return_with_cost, model","Check spelling and case in optimization_criteria.report_type in your YAML","Upgrade/downgrade qlib to the version whose tuner examples you are following if the accepted set differs"],"exampleFix":"# before (tuner_config.yaml)\noptimization_criteria:\n  report_type: long\n\n# after\noptimization_criteria:\n  report_type: pred_long","handlingStrategy":"validation","validationCode":"VALID_REPORT_TYPES = {'pred_long', 'pred_long_short', 'pred_short', 'excess_return_without_cost', 'excess_return_with_cost', 'model'}\nassert cfg['optimization_criteria']['report_type'] in VALID_REPORT_TYPES","typeGuard":"def is_valid_report_type(rt: str) -> bool:\n    return rt in {'pred_long', 'pred_long_short', 'pred_short', 'excess_return_without_cost', 'excess_return_with_cost', 'model'}","tryCatchPattern":null,"preventionTips":["Schema-validate tuner YAMLs (report_type, report_factor, optim_type) before loading","Keep values lowercase exactly as documented"],"tags":["qlib","tuner","configuration","validation"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}