Bug Description
The Home Assistant Mealie integration crashes with an InvalidFieldValue exception
when fetching mealplans that contain recipes where dateAdded is null. This
completely breaks the integration's mealplan coordinator — no mealplan data is
returned at all.
Traceback
mashumaro.exceptions.InvalidFieldValue: Field "date_added" of type date in
BaseRecipe has invalid value None
mashumaro.exceptions.InvalidFieldValue: Field "recipe" of type Optional[BaseRecipe]
in Mealplan has invalid value {...}
mashumaro.exceptions.InvalidFieldValue: Field "items" of type list[Mealplan] in
MealplanResponse has invalid value [...]
Root Cause
BaseRecipe declares date_added as date, but the Mealie API legitimately
returns null for this field — for example on recipes imported via third-party
sync tools (e.g. kptncook). Since one affected recipe poisons the entire
MealplanResponse, the whole mealplan fetch fails.
Expected Behavior
date_added should be typed as Optional[date] so that null values are
handled gracefully instead of crashing the entire response deserialization.
Suggested Fix
# Before
date_added: date
# After
date_added: Optional[date] = None
Environment
- Home Assistant (current stable)
- Mealie (self-hosted, current stable)
- Recipes with
dateAdded: null imported via kptncook sync
Bug Description
The Home Assistant Mealie integration crashes with an
InvalidFieldValueexceptionwhen fetching mealplans that contain recipes where
dateAddedisnull. Thiscompletely breaks the integration's mealplan coordinator — no mealplan data is
returned at all.
Traceback
mashumaro.exceptions.InvalidFieldValue: Field "date_added" of type date in
BaseRecipe has invalid value None
mashumaro.exceptions.InvalidFieldValue: Field "recipe" of type Optional[BaseRecipe]
in Mealplan has invalid value {...}
mashumaro.exceptions.InvalidFieldValue: Field "items" of type list[Mealplan] in
MealplanResponse has invalid value [...]
Root Cause
BaseRecipedeclaresdate_addedasdate, but the Mealie API legitimatelyreturns
nullfor this field — for example on recipes imported via third-partysync tools (e.g. kptncook). Since one affected recipe poisons the entire
MealplanResponse, the whole mealplan fetch fails.Expected Behavior
date_addedshould be typed asOptional[date]so thatnullvalues arehandled gracefully instead of crashing the entire response deserialization.
Suggested Fix
Environment
dateAdded: nullimported via kptncook sync