jdx/mise · error

idiomatic version files markers are reversed

Error message

idiomatic version files markers are reversed

What it means

Thrown while regenerating the idiomatic version files section of rendered help/docs. The renderer locates IDIOMATIC_FILES_START and IDIOMATIC_FILES_END markers in the template; if the start marker appears after the end marker, the slice would be invalid, so it bails. This guards against corrupted or hand-edited template content.

Solutions

  1. Open the template containing the markers and ensure IDIOMATIC_FILES_START occurs before IDIOMATIC_FILES_END exactly once each
  2. Restore the template section from git history (git checkout / revert the bad edit)
  3. Resolve any leftover merge-conflict markers around the section
  4. Regenerate docs with `mise run render:help` after fixing the markers

Example fix

// before (template)
<!-- end idiomatic files -->
<!-- start idiomatic files -->
// after
<!-- start idiomatic files -->
...content...
<!-- end idiomatic files -->
Defensive patterns

Strategy: validation

Validate before calling

grep -n "start idiomatic" docs/help-template.md && grep -n "end idiomatic" docs/help-template.md # start line must be < end line, each once

Prevention

When it happens

Trigger: Calling render_idiomatic_version_files (part of `mise render:help`-style rendering) when the source document's start marker is positioned after the end marker, or markers are duplicated/misplaced.

Common situations: Manual edits to the help template reordered or deleted markers, a merge conflict left markers out of order, or marker constants changed while the template did not.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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

Appendix: source

Thrown at src/cli/render_help.rs:41

            cmd!("prettier.cmd", "--write", "docs/.vitepress/cli_commands.ts").run()?;
        } else {
            cmd!("prettier", "--write", "docs/.vitepress/cli_commands.ts").run()?;
        }
        Ok(())
    }
}

fn render_idiomatic_version_files() -> Result<()> {
    let path = "docs/configuration.md";
    let content = file::read_to_string(path)?;
    let start = content
        .find(IDIOMATIC_FILES_START)
        .wrap_err("missing idiomatic version files start marker")?
        + IDIOMATIC_FILES_START.len();
    let end = content
        .find(IDIOMATIC_FILES_END)
        .wrap_err("missing idiomatic version files end marker")?;
    ensure!(start <= end, "idiomatic version files markers are reversed");

    let table = render_idiomatic_version_files_table();
    let rendered = format!(
        "{}\n\n{}\n\n{}",
        &content[..start],
        table.trim(),
        &content[end..]
    );
    file::write(path, rendered)?;
    Ok(())
}

fn render_idiomatic_version_files_table() -> String {
    let rows = registry::baked_registry()
        .iter()
        .filter(|(plugin, tool)| *plugin == tool.short && !tool.idiomatic_files.is_empty())
        .map(|(plugin, tool)| {
            let files = tool

View on GitHub (pinned to 533346cc37)