Skip to content

Conversation

@andreynering
Copy link
Member

Before this patch, a generic file does not exist is being shown, which is not useful enough.

We used to have a user-friendlier message in the past, but it probably was lost in the recent refactors.

Before:

$ task
file does not exist

After:

$ task
task: No Taskfile found at "/Users/andrey/Developer/repo" (or any of the parent directories). Run `task --init` to create a new Taskfile.

@andreynering andreynering self-assigned this Sep 21, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the error message shown when a Taskfile is not found, replacing a generic "file does not exist" message with a more user-friendly message that includes the search location and suggests running task --init to create a new Taskfile.

  • Adds proper error handling in getRootNode() to catch file not found errors and convert them to a structured TaskfileNotFoundError
  • Enhances the TaskfileNotFoundError structure with an AskInit field to control when to suggest initialization
  • Updates the error message format to include helpful guidance for users

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
setup.go Adds error handling to detect missing Taskfiles and return structured error with init suggestion
errors/errors_taskfile.go Extends TaskfileNotFoundError with AskInit field and updates message formatting

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@andreynering andreynering merged commit 028ae1a into main Sep 21, 2025
13 checks passed
@andreynering andreynering deleted the fix-no-taskfile-error branch September 21, 2025 19:10
andreynering added a commit that referenced this pull request Sep 21, 2025
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.

3 participants