You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Front matter: a date nested in a dict or list crashes the build (TypeError in dict_to_fm_field_list) #1203
A YAML date nested inside a dict or a list in the front matter stops the whole Sphinx build:
File "myst_parser/mdit_to_docutils/base.py", line 1390, in dict_to_fm_field_list
value = json.dumps(value)
TypeError: Object of type date is not JSON serializable
dict_to_fm_field_list lets top-level date / datetime values through the isinstance check
(this was the fix for #252), but a date one level down reaches json.dumps(value) with no default=. The except (ValueError, RecursionError) around that call does not catch TypeError,
so this is an exception, not a warning, and --keep-going does not help.
Expected Behavior
The build succeeds. Either of these one-line changes fits the existing code:
json.dumps(value, default=str) - the nested date becomes an ISO string, the same as a
top-level date after str(value).
Add TypeError to the existing except (ValueError, RecursionError), so the field is skipped
with the same MD_TOPMATTER warning.
I tested the first one on master (Linux and Windows): all four cases below then build with no
warnings.
To Reproduce
conf.py:
extensions= ["myst_parser"]
index.md:
---review:
date: 2026-08-03---# Test
Run sphinx-build -b html . _build. The build stops with the TypeError above.
Results for four variants (same result on 5.1.0 and on master, on Linux and on Windows):
Activity