diff --git a/src/everest/config/model_config.py b/src/everest/config/model_config.py index 84b67594e7f..c4a02058cdb 100644 --- a/src/everest/config/model_config.py +++ b/src/everest/config/model_config.py @@ -2,6 +2,8 @@ from ert.config import ConfigWarning +EMPTY_MODEL_CONFIG_WARNING = "`model` cannot be empty, it needs to contain `realizations` (a list of non-negative integers with length > 0)" + class ModelConfig(BaseModel, extra="forbid"): # type: ignore realizations: list[NonNegativeInt] = Field( @@ -27,6 +29,9 @@ class ModelConfig(BaseModel, extra="forbid"): # type: ignore @model_validator(mode="before") @classmethod def remove_deprecated(cls, values): + if values is None: + raise ValueError(EMPTY_MODEL_CONFIG_WARNING) + if values.get("report_steps") is not None: ConfigWarning.warn( "report_steps no longer has any effect and can be removed." @@ -37,6 +42,9 @@ def remove_deprecated(cls, values): @model_validator(mode="before") @classmethod def validate_realizations_weights_same_cardinaltiy(cls, values): # pylint: disable=E0213 + if values is None: + raise ValueError(EMPTY_MODEL_CONFIG_WARNING) + weights = values.get("realizations_weights") reals = values.get("realizations")