Skip to content

MealplanResponse parsing fails when recipe dateAdded is null #728

Closed

Description

@TheZargs

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

Activity

  1. andrew-codechimp commented on Apr 25, 2026

    @andrew-codechimp
    Collaborator

    Thanks for reporting this, a fix has been made in the library and a PR for Home Assistant has been created, once merged it will be in a future release.

  2. locked and limited conversation to collaborators on May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions