jdx/mise · error

Tool stub file does not exist

Error message

Tool stub file does not exist: {}

What it means

This error is thrown by `lock_stub` when the stub output file (`--output` path) does not exist at the time `mise generate tool-stub --lock` runs. Locking pins checksums into an existing stub file, so the file must already have been generated.

Solutions

  1. Generate the stub first: mise generate tool-stub <tool> --url ... (without --lock), then run --lock
  2. Verify the --output path matches the actual stub file location (use an absolute path)
  3. cd to the directory containing the stub or fix the relative path

Example fix

// before
mise generate tool-stub mytool --lock  # stub never generated
// after
mise generate tool-stub mytool --url https://example.com/mytool.tar.gz
mise generate tool-stub mytool --lock
Defensive patterns

Strategy: validation

Validate before calling

STUB_PATH="stubs/mytool.toml"
if [[ ! -f "$STUB_PATH" ]]; then
  echo "stub missing; generate it first" >&2
  mise generate tool-stub mytool --url "$URL" --output "$STUB_PATH"
fi

Prevention

When it happens

Trigger: Running `mise generate tool-stub <tool> --lock` without first generating the stub, or with an --output path that differs from where the stub was written.

Common situations: Typos in the --output path; running --lock from a different directory with a relative path; deleting or renaming the stub after generation and then attempting to lock.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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

Appendix: source

Thrown at src/cli/generate/tool_stub.rs:770

        // Strategy 3: If there's only one executable total, use it
        if executables.len() == 1 {
            return Ok(executables[0].clone());
        }

        // No good match found, provide helpful error message
        let mut exe_list = executables.to_vec();
        exe_list.sort();

        bail!(
            "Could not determine which executable to use for '{}'. Available executables:\n  {}\n\nUse --bin to specify the correct binary path.",
            tool_name,
            exe_list.join("\n  ")
        );
    }

    async fn lock_stub(&self) -> Result<String> {
        if !self.output.exists() {
            bail!(
                "Tool stub file does not exist: {}",
                display_path(&self.output)
            );
        }

        let mut stub = ToolStubFile::from_file(&self.output)?;
        let config = Config::get().await?;

        // Allow --version to override the version in the stub for bumping
        if self.version != "latest" {
            stub.version = self.version.clone();
        }

        // Create tool request and resolve version
        let request = stub.to_tool_request(&self.output)?;
        let backend = request.ba().backend()?;
        let resolve_opts = ResolveOptions {
            use_locked_version: false,

View on GitHub (pinned to 533346cc37)