Skip to content

Intermittent failure to find taskfile in subdirectory #1964

@omusavi

Description

@omusavi

Description

Hi all,
Seeing some strange behavior with my taskfiles intermittently not being discovered. I am not sure if this is an environment issue or something related to the way I have configured by directories, and -v does not give any useful debugging information.

Occasionally, I will get stuck in a state where any task run in a directory that previously ran tasks fine just stops working. I have noticed this happening in times where there is no taskfile in the directory, but there is one in a root directory that is not being found. Here is some terminal output showing that:

vscode ➜ /workspaces/homelab/apps/paperless-ngx (apps-devexp) $ task up
task: [up] nomad job run -detach -address=http://127.0.0.1:4646  *.nomad.hcl
Job registration successful
Evaluation ID: 65dfbe65-6d95-acc2-7327-234e475dee92
vscode ➜ /workspaces/homelab/apps/paperless-ngx (apps-devexp) $ task up
task: No Taskfile found at "/workspaces/homelab/apps/paperless-ngx"
vscode ➜ /workspaces/homelab/apps/paperless-ngx (apps-devexp) $ task up
task: No Taskfile found at "/workspaces/homelab/apps/paperless-ngx"
vscode ➜ /workspaces/homelab/apps/paperless-ngx (apps-devexp) $ task up
task: No Taskfile found at "/workspaces/homelab/apps/paperless-ngx"
vscode ➜ /workspaces/homelab/apps/paperless-ngx (apps-devexp) $ task up
task: No Taskfile found at "/workspaces/homelab/apps/paperless-ngx"
vscode ➜ /workspaces/homelab/apps/paperless-ngx (apps-devexp) $ task
task: No Taskfile found at "/workspaces/homelab/apps/paperless-ngx"
vscode ➜ /workspaces/homelab/apps/paperless-ngx (apps-devexp) $ task -v
task: No Taskfile found at "/workspaces/homelab/apps/paperless-ngx"
vscode ➜ /workspaces/homelab/apps/paperless-ngx (apps-devexp) $ task --version
Task version: v3.40.1 (h1:Q/TjPh5SAI+XK2fBravDPZXNGm6mvnwrLJqCXfhZ3Wc=)
vscode ➜ /workspaces/homelab/apps/paperless-ngx (apps-devexp) $ task --list-all
task: Available tasks for this project:
# goes on to list all the tasks just fine

The first line everything works fine, I made no changes to the task files and when rerunning the same command, taskfiles are not found. After a while though, it will work again.

This is running in an Ubuntu 24.04 based VS Code devcontainer on a Mac OS device, I am not sure if that is related.

The structure of my taskfiles is the following, also not sure if its related:

apps/
├── paperless-ngx/
Taskfile.yml
tasks/
├── nomad.yml

The file nomad.yml contains the up task I am calling in the example above. It is included in the root Taskfile.yml as such:

includes:
  nomad:
    taskfile: tasks/nomad.yml
    flatten: true

And just in case it matters (I don't think it does because I have seen other similar subdirectory issues outside of this example):

  up:
    desc: Run the nomad job defined in the current directory
    dir: "{{.NOMAD_DIR | default .USER_WORKING_DIR}}"
    cmds:
      - nomad job run -detach -address={{.NOMAD_ADDR}} {{.NOMAD_FLAGS}} *.nomad.hcl

Looking at where this error is thrown I am not seeing where there might be an intermittent issue, but I am hoping you all can help me debug this!

Maybe simpler repro

Simple example of how a parent directory task is not being called read when in this state:

vscode ➜ /workspaces/homelab (apps-devexp) $ task --list-all
task: Available tasks for this project:
[REDACTED]
vscode ➜ /workspaces/homelab (apps-devexp) $ cd apps
vscode ➜ /workspaces/homelab/apps (apps-devexp) $ task --list-all
task: No Taskfile found at "/workspaces/homelab/apps"

Thanks!

Version

3.40.1

Operating system

Ubuntu 24.04

Experiments Enabled

No response

Example Taskfile

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions