Skip to content

Conversation

@railgun-0402
Copy link

Summary

  • Fix regression where task shows No Taskfile found at "" instead of the full error message with path and --init suggestion

Problem

When running task in a directory without a Taskfile, NewFileNode() in node_file.go wraps os.ErrNotExist into a TaskfileNotFoundError before returning. In getRootNode() (setup.go), the
error check uses os.IsNotExist(err), which fails to match the already-wrapped error. As a result, the enriched error (with the correct path, Walk: true, and AskInit: true) is never constructed,
and the incomplete TaskfileNotFoundError from NewFileNode() is returned as-is.

Fix

Replace os.IsNotExist(err) with errors.As(err, &taskfileNotFoundErr) so that the wrapped TaskfileNotFoundError is properly detected.

Before: task: No Taskfile found at ""
After: task: No Taskfile found at "/path/to/dir" (or any of the parent directories). Run task --init to create a new Taskfile.

Closes #2581

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Taskfile not found error shows empty path and missing --init suggestion

1 participant