jdx/mise · error

unknown idiomatic file field

Error message

unknown idiomatic file field: {key}

What it means

This error is thrown while parsing the idiomatic version-file section of a registry tool. When the section is a TOML table, every key must be one of the known fields (path, version_regex, version_json_path, version_expr, ...); any other key is rejected. This catches typos and unsupported options early instead of silently ignoring them.

Solutions

  1. Rename the unknown key to one of the allowed fields: path, version_regex, version_json_path, version_expr (plus any others in the allowlist)
  2. Check for typos in the field name at the reported key
  3. Remove the key if it was not actually a supported option

Example fix

// before
[tools.python.version-file]
path = ".python-version"
version_pattern = "^(\\d+\\.\\d+)"
// after
[tools.python.version-file]
path = ".python-version"
version_regex = "^(\\d+\\.\\d+)"
Defensive patterns

Strategy: validation

Validate before calling

const IDIOMATIC_FILE_FIELDS: &[&str] = &["path", "version_regex", "version_json_path", "version_expr"];
fn validate_idiomatic_file(table: &toml::Value) -> Result<(), String> {
    if let Some(t) = table.get("version-file").and_then(|v| v.as_table()) {
        for key in t.keys() {
            if !IDIOMATIC_FILE_FIELDS.contains(&key.as_str()) {
                return Err(format!("unknown idiomatic file field: {key}"));
            }
        }
    }
    Ok(())
}

Prevention

When it happens

Trigger: Writing an idiomatic-file table in registry TOML containing a key outside the allowlist, e.g. `version-file = { path = "...", verssion_regex = "..." }` (typo) or a made-up field.

Common situations: Typos in field names; copying fields from a different config schema (e.g. generic tool config) into the idiomatic file section; following outdated documentation.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/4fee15eed66cc7a7. Report an issue: GitHub.

Appendix: source

Thrown at src/registry.rs:499

                .map(parse_registry_idiomatic_file)
                .collect()
        })
        .transpose()
        .map(Option::unwrap_or_default)
}

fn parse_registry_idiomatic_file(value: &toml::Value) -> Result<RegistryIdiomaticFile> {
    match value {
        toml::Value::String(path) => Ok(RegistryIdiomaticFile {
            path: leak_string(path.clone()),
            version_regex: None,
            version_json_path: None,
            version_expr: None,
            deprecated: None,
        }),
        toml::Value::Table(table) => {
            for key in table.keys() {
                ensure!(
                    matches!(
                        key.as_str(),
                        "path"
                            | "version_regex"
                            | "version_json_path"
                            | "version_expr"
                            | "deprecated"
                    ),
                    "unknown idiomatic file field: {key}"
                );
            }
            let string = |key: &str| -> Result<Option<&'static str>> {
                table
                    .get(key)
                    .map(|value| {
                        value
                            .as_str()
                            .map(|value| leak_string(value.to_string()))

View on GitHub (pinned to 533346cc37)