diff --git a/process/core/input.py b/process/core/input.py index 825efef1d..4de1b391c 100644 --- a/process/core/input.py +++ b/process/core/input.py @@ -2137,6 +2137,12 @@ def parse_input_file(data_structure_obj: DataStructure): variable_config = copy.copy(INPUT_VARIABLES.get(variable_name)) + if variable_config is None: + error_msg = ( + f"Unrecognised input '{variable_name}' at line {line_no} of input file." + ) + raise ProcessValidationError(error_msg) + # string indicates it should be set on the new object data structure if isinstance(variable_config.module, str): module = data_structure_obj @@ -2145,12 +2151,6 @@ def parse_input_file(data_structure_obj: DataStructure): variable_config.module = module - if variable_config is None: - error_msg = ( - f"Unrecognised input '{variable_name}' at line {line_no} of input file." - ) - raise ProcessValidationError(error_msg) - # Validate the variable and also clean it (cast to correct type) # If the variable value (after the = sign) contains a ',' then it # defines the whole array so needs to be split down into its elements