jdx/mise · error

task was not found after marking as executable

Error message

task {} was not found after marking {} as executable

What it means

`make_task_executable` chmods a task file and then re-resolves the task by name (including aliases) to return it. If the task still cannot be found after the file was made executable, mise throws this error because the earlier 'not executable' diagnosis was wrong or the name lookup is inconsistent.

Solutions

  1. Rename the script (or add an alias) so its task name matches what was invoked, then re-run.
  2. Verify the file is a valid task for mise (correct location, e.g. `.mise/tasks/`, and executable) and re-run `mise tasks`.
  3. Clear any stale state by re-running the command from the project root so the task map reloads.

Example fix

// before
.mise/tasks/deploy   # invoked as: mise run deploy-prod

// after
.mise/tasks/deploy-prod   # name matches the invoked task
Defensive patterns

Strategy: validation

Validate before calling

# ensure the script name matches the invoked task
[ -x ".mise/tasks/$task" ] && mise run "$task"

Prevention

When it happens

Trigger: Called from `err_no_task` after a `task not found` failure: the file at `path` was chmod +x, but `build_task_ref_map(all_tasks).get_matching(name)` still yields nothing — e.g. the script's name doesn't match what the user invoked (different stem, missing alias) or the task list wasn't refreshed.

Common situations: Running `mise run myscript` where `myscript` is a plain executable file mise tried to auto-register, but the file's basename or shebang doesn't map to the requested name; stale task cache after renaming files.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at src/task/task_list.rs:261

        return Ok(None);
    }
    let confirmed = config::Settings::get().yes
        || prompt::confirm("Mark this file as executable to allow it to be run as a task?")?
            .is_yes();
    if !confirmed {
        return Ok(None);
    }

    file::make_executable(&path)?;
    info!("marked as executable");
    let all_tasks = config.reload_tasks_with_context(task_context).await?;
    let tasks_with_aliases = crate::task::build_task_ref_map(all_tasks.iter());
    let task = tasks_with_aliases
        .get_matching(name)?
        .into_iter()
        .next()
        .map(|task| (*task).clone());
    ensure!(
        task.is_some(),
        "task {} was not found after marking {} as executable",
        style::ered(name),
        display_path(&path)
    );
    Ok(task)
}

async fn err_no_task(
    config: &Arc<Config>,
    name: &str,
    task_context: Option<&TaskLoadContext>,
) -> Result<Option<Task>> {
    // Check early if the name looks like a mistyped CLI subcommand
    let similar_cmds = suggest_similar_commands(name);
    let (tasks_for_error, showing_all_tasks) = tasks_for_missing_task_error(config, name).await?;

    if tasks_for_error.is_empty() {

View on GitHub (pinned to 533346cc37)