diff --git a/app/lib_api_crud_v3.py b/app/lib_api_crud_v3.py index e441b6c..c49b5ec 100644 --- a/app/lib_api_crud_v3.py +++ b/app/lib_api_crud_v3.py @@ -43,6 +43,12 @@ def format_db_error(raw_error: str) -> StandardError: recoverable = True elif code in [1054, 1146]: # Unknown column / Table category = "database_schema" + elif code == 1364: # Field has no default value — model/schema mismatch + category = "database_schema" + field_match = re.search(r"Field '([^']+)' doesn't have a default value", message) + if field_match: + field_name = field_match.group(1) + message = f"Schema mismatch: column '{field_name}' is NOT NULL with no default but was not included in the insert. Check the model definition and database schema." else: category = "database"