jdx/mise · error

{raw}: target must be absolute or start with ~/

Error message

{raw}: target must be absolute or start with ~/

What it means

Thrown by `mise bootstrap dotfiles edit` when the TARGET is not yet managed by any `[dotfiles]` file or edit entry AND the resolved target path is relative. Before offering to add a new dotfile, mise requires an unambiguous location: an absolute path or one starting with `~/`. A relative path like `src/.env` would resolve differently depending on the working directory, so it is rejected up front.

Source

Thrown at src/cli/dotfiles/edit.rs:128

                } => path.clone(),
                EditOp::Block {
                    source: BlockSource::Inline(_),
                    ..
                }
                | EditOp::Line { .. } => req.config_path.clone(),
            }));
        }
        edits => {
            let keys = edits
                .iter()
                .map(|req| req.config_key())
                .collect::<Vec<_>>()
                .join(", ");
            bail!("{raw}: multiple [dotfiles] edit entries match; choose one of: {keys}");
        }
    }
    if target.is_relative() {
        bail!("{raw}: target must be absolute or start with ~/");
    }
    Ok(None)
}

fn open_or_create(path: &std::path::Path) -> Result<()> {
    if !path.exists() {
        if let Some(parent) = path.parent() {
            file::create_dir_all(parent)?;
        }
        file::write(path, "")?;
    }
    Ok(())
}

async fn apply_target(target: &str) -> Result<()> {
    let config = Config::reset().await?;
    let targets = vec![target.to_string()];
    let files = system::files::files_from_config(&config)?

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Re-run with an absolute path or a `~/`-prefixed path, e.g. `mise bootstrap dotfiles edit ~/.config/app/config.toml`
  2. If you meant an existing managed dotfile, check its exact target with `mise bootstrap dotfiles status` and copy that spelling
  3. If the file belongs to a project, use the absolute path of the repo file, not a cwd-relative one

Example fix

# before
$ mise bootstrap dotfiles edit .zshrc
error: .zshrc: target must be absolute or start with ~/

# after
$ mise bootstrap dotfiles edit ~/.zshrc
Defensive patterns

Strategy: validation

Validate before calling

# shell: reject relative targets before calling mise
case "$1" in /*|~/*) mise bootstrap dotfiles edit "$1" ;; *) echo "target must be absolute or ~/..." >&2; exit 2 ;; esac

Prevention

When it happens

Trigger: Running `mise bootstrap dotfiles edit .zshrc` or `mise bootstrap dotfiles edit config/app.toml` where no `[[dotfiles.files]]` or `[[dotfiles.edit]]` entry matches — `source_for_target` finds nothing, `target.is_relative()` is true, and it bails before the add flow.

Common situations: Typing a bare filename out of habit instead of the full path; copying a target name from a listing that shows it relative to $HOME; running the command from a subdirectory expecting cwd-relative resolution.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/5c5e0bb469582de4. Report an issue: GitHub.