{"record":{"id":"6bebe754f512e34c","repo":"OpenBB-finance/OpenBB","slug":"invalid-value-s-for-dimension-dim-id-invali-6bebe7","errorCode":null,"errorMessage":"Invalid value(s) for dimension '{dim_id}': {invalid_values}. Given prior selections {prior_selections}, available values are: {available_values}","messagePattern":"Invalid value\\(s\\) for dimension '(.+?)': (.+?)\\. Given prior selections (.+?), available values are: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/imf/openbb_imf/utils/table_builder.py","lineNumber":695,"sourceCode":"            if missing_indicator_dims and not any(\n                d in fetch_kwargs for d in indicator_dims_set\n            ):\n                # Use the same error format as query_builder validation\n                for dim_id in missing_indicator_dims:\n                    invalid_values = dimension_codes.get(dim_id, [])\n                    # Get available values for this dimension\n                    available_options = builder.get_options_for_dimension(dim_id)\n                    available_values = sorted(  # type: ignore\n                        {opt[\"value\"] for opt in available_options}\n                    )\n                    # Build prior selections dict\n                    prior_selections = {\n                        d: normalized_kwargs.get(d)\n                        for d in dims_in_order\n                        if d in normalized_kwargs\n                        and dims_in_order.index(d) < dims_in_order.index(dim_id)\n                    }\n                    raise ValueError(\n                        f\"Invalid value(s) for dimension '{dim_id}': {invalid_values}. \"\n                        f\"Given prior selections {prior_selections}, \"\n                        f\"available values are: {available_values}\"\n                    )\n\n            # Handle any dimension codes not in the standard order\n            for dim_id, codes in dimension_codes.items():\n                if dim_id not in dims_in_order and dim_id not in fetch_kwargs:\n                    # Validate these codes against available options\n                    available_options = builder.get_options_for_dimension(dim_id)\n                    available_values = {opt[\"value\"] for opt in available_options}\n                    filtered_codes = [c for c in codes if c in available_values]\n\n                    # If no exact matches, try prefix matching\n                    if not filtered_codes:\n                        for hier_code in codes:\n                            matching_codes = [\n                                av","sourceCodeStart":677,"sourceCodeEnd":713,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/imf/openbb_imf/utils/table_builder.py#L677-L713","documentation":"Same 'Invalid value(s) for dimension' contract as error 641, but raised in a later phase: after the hierarchy is applied, when a dimension expected to carry indicator values (from missing_indicator_dims) has values that don't validate against builder.get_options_for_dimension(). It is deliberately re-raised (not suppressed by the progressive-filtering fallback) so validation errors always surface.","triggerScenarios":"The user provided a value for an indicator dimension (INDICATOR/SERIES/ITEM/BOP_ACCOUNTING_ENTRY) that passes hierarchy mapping but fails option validation - e.g. a series code that exists in the hierarchy yet is not selectable for this table's current dimension state.","commonSituations":"Deprecated indicator codes still present in older docs or notebooks; codes valid for annual frequency but not monthly; partial code strings or wrong separators ('+A+B' style multi-values with a bad member).","solutions":["Replace the offending value with one from the sorted available_values list printed in the message.","Adjust prior selections (frequency, country) that constrain which indicator values are selectable.","Verify the indicator code against IMF's current SDMX codelist for that dataset.","Update openbb-imf to pick up refreshed hierarchy metadata."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Check indicator codes against current codelist before the fetch\ncodes = {'INDICATOR': ['EDP', 'XYZ']}\nvalid_codes = {c.value for c in obb.economy.imf.codelists(dataset='IFS').results}\nfiltered = {k: [c for c in v if c in valid_codes] for k, v in codes.items()}\nassert all(filtered.values()), 'some indicator codes are not selectable for this table'","typeGuard":"def all_codes_selectable(codes: list[str], available: set[str]) -> bool:\n    return bool(codes) and all(c in available or c == '*' for c in codes)","tryCatchPattern":"try:\n    res = obb.economy.imf.fetch(...)\nexcept ValueError as e:\n    if 'Invalid value(s) for dimension' in str(e):\n        available = parse_available_from_message(str(e))  # message embeds the valid list\n        params[dim] = available[:1]  # degrade gracefully to first valid value\n    raise","preventionTips":["Source indicator codes from codelist discovery endpoints","Avoid deprecated codes copied from old notebooks","Validate multi-value strings ('A+B+C') member by member"],"tags":["imf","validation","indicator-codes","valueerror"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}