diff --git a/src/ert/config/analysis_config.py b/src/ert/config/analysis_config.py index 6bb55eddf1d..51fc80cef7c 100644 --- a/src/ert/config/analysis_config.py +++ b/src/ert/config/analysis_config.py @@ -126,7 +126,14 @@ def __init__( var_name = "inversion" key = var_name.lower() - options[module_name][key] = value + try: + options[module_name][key] = value + except KeyError: + all_errors.append( + ConfigValidationError( + f"Invalid configuration: ANALYSIS_SET_VAR {module_name} {var_name}" + ) + ) if errors: all_errors.append( diff --git a/tests/unit_tests/config/test_analysis_config.py b/tests/unit_tests/config/test_analysis_config.py index 0f58853ef98..7bf48d8dcdf 100644 --- a/tests/unit_tests/config/test_analysis_config.py +++ b/tests/unit_tests/config/test_analysis_config.py @@ -345,6 +345,10 @@ def test_misfit_configuration(config, expected): [["OBSERVATIONS", "SAUTO_SCALE", "OBS_*"]], pytest.raises(ConfigValidationError, match="Unknown variable"), ), + ( + [["NOT_A_THING", "AUTO_SCALE", "OBS_*"]], + pytest.raises(ConfigValidationError, match="ANALYSIS_SET_VAR NOT_A_THING"), + ), ], ) def test_config_wrong_module(config, expectation):