diff --git a/src/backend/InvenTree/InvenTree/config.py b/src/backend/InvenTree/InvenTree/config.py index 07ba769879..0f0770ab1f 100644 --- a/src/backend/InvenTree/InvenTree/config.py +++ b/src/backend/InvenTree/InvenTree/config.py @@ -7,6 +7,7 @@ import os import random import shutil import string +import sys from pathlib import Path from typing import Optional @@ -195,7 +196,13 @@ def load_config_data(set_cache: bool = False) -> map | None: cfg_file = get_config_file() with open(cfg_file, encoding='utf-8') as cfg: - data = yaml.safe_load(cfg) + try: + data = yaml.safe_load(cfg) + except yaml.parser.ParserError as error: + logger.error( + "Error reading InvenTree configuration file '%s': %s", cfg_file, error + ) + sys.exit(1) # Set the cache if requested if set_cache: