{"record":{"id":"30da0fba4e4d300a","repo":"jdx/mise","slug":"task-was-not-found-after-marking-as-executab","errorCode":null,"errorMessage":"task {} was not found after marking {} as executable","messagePattern":"task (.+?) was not found after marking (.+?) as executable","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/task/task_list.rs","lineNumber":261,"sourceCode":"        return Ok(None);\n    }\n    let confirmed = config::Settings::get().yes\n        || prompt::confirm(\"Mark this file as executable to allow it to be run as a task?\")?\n            .is_yes();\n    if !confirmed {\n        return Ok(None);\n    }\n\n    file::make_executable(&path)?;\n    info!(\"marked as executable\");\n    let all_tasks = config.reload_tasks_with_context(task_context).await?;\n    let tasks_with_aliases = crate::task::build_task_ref_map(all_tasks.iter());\n    let task = tasks_with_aliases\n        .get_matching(name)?\n        .into_iter()\n        .next()\n        .map(|task| (*task).clone());\n    ensure!(\n        task.is_some(),\n        \"task {} was not found after marking {} as executable\",\n        style::ered(name),\n        display_path(&path)\n    );\n    Ok(task)\n}\n\nasync fn err_no_task(\n    config: &Arc<Config>,\n    name: &str,\n    task_context: Option<&TaskLoadContext>,\n) -> Result<Option<Task>> {\n    // Check early if the name looks like a mistyped CLI subcommand\n    let similar_cmds = suggest_similar_commands(name);\n    let (tasks_for_error, showing_all_tasks) = tasks_for_missing_task_error(config, name).await?;\n\n    if tasks_for_error.is_empty() {","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/task/task_list.rs#L243-L279","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Rename the script (or add an alias) so its task name matches what was invoked, then re-run.","Verify the file is a valid task for mise (correct location, e.g. `.mise/tasks/`, and executable) and re-run `mise tasks`.","Clear any stale state by re-running the command from the project root so the task map reloads."],"exampleFix":"// before\n.mise/tasks/deploy   # invoked as: mise run deploy-prod\n\n// after\n.mise/tasks/deploy-prod   # name matches the invoked task","handlingStrategy":"validation","validationCode":"# ensure the script name matches the invoked task\n[ -x \".mise/tasks/$task\" ] && mise run \"$task\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Name task scripts exactly as you invoke them (or define aliases).","Keep auto-registered scripts inside the tasks directory mise scans.","Re-run `mise tasks` after adding/renaming scripts."],"tags":["task","mise","permissions","not-found"],"backgroundTag":"record-not-found","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}