diff --git a/bentoml/_internal/configuration/containers.py b/bentoml/_internal/configuration/containers.py index 9aa585f58dd..daf5e977460 100644 --- a/bentoml/_internal/configuration/containers.py +++ b/bentoml/_internal/configuration/containers.py @@ -225,6 +225,14 @@ def __init__( ) with open(default_config_file, "rb") as f: self.config: t.Dict[str, t.Any] = yaml.safe_load(f) + if validate_schema: + try: + SCHEMA.validate(self.config) + except SchemaError as e: + raise BentoMLConfigException( + "Default configuration 'default_configuration.yml' does not" + " conform to the required schema." + ) from e # User override configuration if override_config_file is not None: