{"record":{"id":"0fdefa2ae8d5e577","repo":"OpenBB-finance/OpenBB","slug":"error-msg","errorCode":null,"errorMessage":"{error_msg}","messagePattern":"\\{error_msg\\}","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/imf/openbb_imf/utils/table_builder.py","lineNumber":753,"sourceCode":"                        prior_selections = {\n                            d: fetch_kwargs.get(d) or normalized_kwargs.get(d)\n                            for d in dims_in_order\n                            if fetch_kwargs.get(d) or normalized_kwargs.get(d)\n                        }\n                        raise ValueError(\n                            f\"No valid values for dimension '{dim_id}' given constraints. \"\n                            f\"Table indicator codes: {codes}\"\n                            f\"available for {prior_selections}: {sorted(available_values)}\"\n                        )\n\n        except (KeyError, ValueError) as e:\n            # Check if this is a validation error - don't suppress those\n            error_msg = str(e)\n            if (\n                \"Invalid value(s) for dimension\" in error_msg\n                or \"not compatible with dataflow\" in error_msg\n            ):\n                raise ValueError(error_msg) from e\n            # Fallback: use all codes if progressive validation fails\n            warnings.warn(\n                f\"Progressive constraint filtering failed: {e}. Using unfiltered codes.\",\n                OpenBBWarning,\n            )\n            for dim_id, codes in dimension_codes.items():\n                if dim_id not in fetch_kwargs:\n                    # Check if URL would be too long\n                    joined_codes = \"+\".join(codes)\n                    if len(joined_codes) > 1500:\n                        fetch_kwargs[dim_id] = \"*\"\n                        # Store codes for post-fetch filtering\n                        if \"_indicator_codes_to_filter\" not in fetch_kwargs:\n                            fetch_kwargs[\"_indicator_codes_to_filter\"] = set()\n                        fetch_kwargs[\"_indicator_codes_to_filter\"].update(codes)\n                    else:\n                        fetch_kwargs[dim_id] = joined_codes\n","sourceCodeStart":735,"sourceCodeEnd":771,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/imf/openbb_imf/utils/table_builder.py#L735-L771","documentation":"This is a re-raise gate, not a new failure: progressive constraint filtering wraps its logic in 'except (KeyError, ValueError)'. Genuine validation failures ('Invalid value(s) for dimension', 'not compatible with dataflow') are re-raised verbatim; everything else is downgraded to an OpenBBWarning and the code falls back to unfiltered codes. Hitting this error means you are seeing one of the validation ValueErrors (641/643/644) passed through unchanged.","triggerScenarios":"Any of the upstream validation errors (invalid dimension value, incompatible dataflow) raised inside the progressive-filtering try block gets caught here and re-raised with the identical message. The string-matching on error_msg is what decides whether you see an exception or only a warning.","commonSituations":"Same as errors 641/643/644; additionally, refactoring that changes validation message text would silently convert hard failures into the unfiltered-codes fallback - a known fragility of the string-match design.","solutions":["Treat this as error 641/643/644 - read the inner message and fix the dimension value or dataflow/table mismatch.","Do not attempt to handle this raise site itself; fix inputs.","If you maintain this code, replace message-string matching with a dedicated exception type to avoid regressions."],"exampleFix":"# maintainer hardening: use a typed exception instead of string matching\n# before\nif 'Invalid value(s) for dimension' in error_msg or 'not compatible with dataflow' in error_msg:\n    raise ValueError(error_msg) from e\n# after\nclass DimensionValidationError(ValueError): ...\n# raise DimensionValidationError(...) at the sources; here:\nif isinstance(e, DimensionValidationError):\n    raise e","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    res = obb.economy.imf.fetch(dataset=ds, parameters=params)\nexcept ValueError as e:\n    msg = str(e)\n    if 'Invalid value(s) for dimension' in msg:\n        fix_dimension_value(msg)\n    elif 'not compatible with dataflow' in msg:\n        fix_table_dataflow_pair(msg)\n    else:\n        raise","preventionTips":["Recognize this raise site forwards errors 641/643/644 verbatim - fix inputs, not handling","Do not suppress ValueError from IMF fetches; they carry actionable context","If maintaining the library, switch string matching to typed exceptions"],"tags":["imf","error-propagation","validation","valueerror"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}