Skip to content

fix(parser): invalid calendar dates in metadata and custom values silently load as NULL #2811

Closed

Description

@robcohen

Summary

An invalid calendar date as a metadata or custom value loads as MetaValue::None with no error. beancount reports "day is out of range" (or similar).

Reproduce

Input (metadata under any directive) rledger beancount 3.2.3
kk: 2024-02-30 None, no error day is out of range
kk: 2024-13-01, kk: 2023-02-29, kk: 2024-00-01, kk: 2024-01-00, kk: 2024-02-0 None, no error error
2024-01-01 custom "x" 2024-02-30 no error error
kk: 0000-01-01 accepted as a date rejected

The same date on a header line (2024-02-30 open Assets:A) is already reported (P0015). In meta_value_from_tokens a failed parse_date_token falls through to None instead of producing an error.

Fix

Report the invalid date through the same error path as header dates (one canonical date check), matching beancount per row, with tests.

Found in the review of #2810 (part of #2802).

Activity

  1. added
    bug
    on Oct 29, 2026
  2. added a commit that references this issue on Nov 7, 2026
    afa906d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions