jdx/mise · error

" ". : unknown line position ' ' (expected "append" or…

Error message

"{path_raw}".{id}: unknown line position '{other}' (expected "append" or "prepend"), ignoring entry

What it means

For line-based edits, the `position` field accepts only "append" or "prepend" (omitting it defaults to append). Any other value makes `resolve_entry` bail and ignore the entry, because there is no other defined placement for a managed line.

Solutions

  1. Use `position = "append"` to add the line at the end of the file.
  2. Use `position = "prepend"` to add the line at the top of the file.
  3. Remove `position` entirely to get the default (append) behavior.
  4. Re-run the edits command and confirm the entry is applied.

Example fix

# before
[dotfiles."~/.zshrc".path-entry]
line = "export PATH=$HOME/bin:$PATH"
position = "top"

# after
[dotfiles."~/.zshrc".path-entry]
line = "export PATH=$HOME/bin:$PATH"
position = "prepend"
Defensive patterns

Strategy: validation

Validate before calling

if let Some(p) = &e.position {
    if !matches!(p.as_str(), "append" | "prepend") {
        return Err(format!("position must be \"append\" or \"prepend\", got {p}"));
    }
}

Type guard

fn is_valid_position(p: &Option<String>) -> bool {
    p.as_deref().map_or(true, |v| matches!(v, "append" | "prepend"))
}

Prevention

When it happens

Trigger: A line edit entry sets `position = "end"`, `position = "top"`, `position = "after"`, or any misspelling. `resolve_entry` matches `Some(other)` in the position match and bails at src/system/edits.rs:360.

Common situations: Users guess position names from other tools, misspell "append"/"prepend", or copy `position` semantics from an unrelated configuration format.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at src/system/edits.rs:360

                source,
                template,
                comment,
            }
        }
        (false, Some(line)) => {
            // a "line" is matched against the file's individual lines, so an
            // embedded newline could never converge — use a block for
            // multi-line content
            if line.contains('\n') {
                bail!(
                    "\"{path_raw}\".{id}: line may not contain a newline; use a block for multi-line content, ignoring entry"
                )
            }
            let position = match entry.position.as_deref() {
                None | Some("append") => LinePosition::Append,
                Some("prepend") => LinePosition::Prepend,
                Some(other) => {
                    bail!(
                        "\"{path_raw}\".{id}: unknown line position '{other}' (expected \"append\" or \"prepend\"), ignoring entry"
                    )
                }
            };
            EditOp::Line {
                line: line.clone(),
                position,
            }
        }
    };
    Ok(EditRequest {
        path_raw: path_raw.to_string(),
        path,
        id,
        op,
        base: base.to_path_buf(),
        config_path: config_path.to_path_buf(),
        origin,

View on GitHub (pinned to 533346cc37)