A .json5 config file is found, fails to parse, and shadows .yaml
- Status: Todo
- Kind: Bug
- Authors: jp
- Date: 2026-08-27
- Label: package=jp_config
- Label: type=bug
JP probes for configuration files with the extensions toml, json, json5, yaml, yml, in that order (crates/jp_config/src/util.rs:22 and crates/jp_config/src/fs.rs:18).
The loader that parses them does not handle JSON5. Its JSON format accepts json and jsonc only (crates/contrib/schematic/src/config/formats/json.rs:15-19), so a config.json5 file is found by the probe and then fails with NoMatchingFormat.
The shadowing is the worse half. json5 is probed before yaml, so an unparseable config.json5 also hides a perfectly good config.yaml sitting next to it. The user sees a parse error naming a file they may not have known was being read.
The two halves of the crate disagree about this. jp_config::fs::Format does handle JSON5, via serde_json5 (crates/jp_config/src/fs.rs:113), which is presumably why the extension is in the probe list at all. So ConfigFile can read JSON5 while the implicit-loading path cannot.
Options
- Drop
json5from both probe lists. Two constants,util.rs:22andfs.rs:18. A.json5file then goes unnoticed rather than breaking the directory it sits in. Smallest fix. - Register a JSON5 format in schematic.
serde_json5is already a dependency. Makes the probe list honest instead of trimming it. - Add
jsoncto the probe list. The reverse gap:config.jsoncparses fine but is never found, so it is only reachable through an explicit--cfg @path.jsonc.
Pick 1 or 2 depending on whether JSON5 is worth supporting; 3 closes the opposite mismatch either way.
Context
Recorded as a known caveat in RFD 079's "File extensions" section, and now carried as a warning in docs/configuration.md under "File Formats". Found again while checking that document against the code. Deleting the warning from the user documentation is part of fixing this.