Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[turborepo] Error while trying to run script with filter when filter eliminates all possible workspaces #3918

Closed
trappar opened this issue Feb 22, 2023 · 16 comments · Fixed by #3951
Assignees
Labels
kind: bug Something isn't working

Comments

@trappar
Copy link

trappar commented Feb 22, 2023

What version of Turborepo are you using?

1.8.2

What package manager are you using / does the bug impact?

pnpm

What operating system are you using?

Mac

Describe the Bug

In my project, if I'm sitting in the main branch with a clean working copy and I try to run:

turbo --filter "[main]" lint

I get the following output

• Packages in scope: 
• Running lint in 0 packages
• Remote caching disabled

No tasks were executed as part of this run.

 Tasks:    0 successful, 0 total
Cached:    0 cached, 0 total
  Time:    66ms 

However, if I make a modification to a file in my monorepo's root that is not inside a specific package, and is not an input to any package, such as .gitignore, then I get the following output:

 ERROR  run failed: error preparing engine: Could not find the following tasks in project: lint
Turbo error: error preparing engine: Could not find the following tasks in project: lint

Expected Behavior

I should not be getting this error, and turbo should instead simply run no tasks.

To Reproduce

In a monorepo with turborepo, checkout main/master with a clean working copy, then modify the project's .gitignore and try running turbo --filter "[{branch}]" {script} where {branch} is your main/master branch and {script} is any script configured in the turbo.json pipelines.

I just tested and this can be replicated using the starter monorepo created via npx create-turbo@latest

Reproduction Repo

No response

@trappar trappar added area: turborepo kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage labels Feb 22, 2023
@tknickman
Copy link
Member

Hey @trappar, this should be fixed in 1.8.2 (released today)!

@trappar
Copy link
Author

trappar commented Feb 22, 2023

Oops, sorry I was mistaken in the bug report. I'm actually already on 1.8.2, and it's still occurring. I'll update my original issue to reflect that.

% turbo --version             
1.8.2
% turbo --filter "[main]" lint
 ERROR  run failed: error preparing engine: Could not find the following tasks in project: lint
Turbo error: error preparing engine: Could not find the following tasks in project: lint

Just double checked and both my globally installed and locally installed versions are at 1.8.2.

@trappar
Copy link
Author

trappar commented Feb 22, 2023

@tknickman could you please reopen? 😅

This appears to be an unfixed edge case of the issue that was fixed in 1.8.2.

@tknickman
Copy link
Member

tknickman commented Feb 22, 2023

Ah, my fault @trappar, sorry about that! We'll take a look.

@tknickman tknickman reopened this Feb 22, 2023
@tkstang
Copy link

tkstang commented Feb 24, 2023

I am experiencing this issue as well. Thanks for taking a look!

@mehulkar mehulkar self-assigned this Feb 24, 2023
@mehulkar mehulkar removed the needs: triage New issues get this label. Remove it after triage label Feb 24, 2023
@mehulkar
Copy link
Contributor

mehulkar commented Feb 24, 2023

Thanks for the reporting @trappar and @tkstang! I was able to reproduce and the fix issue in #3951. We should hopefully get a new patch release out shortly (this issue will probably close on merge). The explanation for the bug is essentially the same as in #3896 (comment). Apologies for the inconvenience!

@mehulkar
Copy link
Contributor

Just an update: we released 1.8.3 with the fix: https://github.com/vercel/turbo/releases/tag/v1.8.3

@Tittoh
Copy link

Tittoh commented Mar 4, 2023

I just created a new project and quick search on a similar error brought me here.

run failed: error preparing engine: Could not find the following tasks in project: hello
Turbo error: error preparing engine: Could not find the following tasks in project: hello

according to the docs, Understanding turbo.json the expected error is:

task `hello` not found in turbo `pipeline` in "turbo.json".
Are you sure you added it?

dev, lint and `build commands are working as expected.

v: 1.8.3

@mehulkar
Copy link
Contributor

mehulkar commented Mar 4, 2023

@Tittoh good catch. Could you file a new issue to update the docs? If you don’t get to it I’ll make a note to do this on Monday! The error message did indeed change

@arantespp
Copy link

I got this error with v: 1.8.3 and running lint from root (//#lint). My turbo.json config.

image

@nathanhammond
Copy link
Contributor

@arantespp //#lint is how to address that root task.

@arantespp
Copy link

It's working now! It didn't work if I updated manually (yarn add -DW turbo), but it worked when I updated via codemod (npx @turbo/codemod update).

@rhkdgns95
Copy link

rhkdgns95 commented Sep 22, 2023

This issue can be resolved by downgrading the version to 1.10.4.

It's not an ideal solution.

@magicspon
Copy link

I'm seeing this issue as well

yarn lint - works
turbo run link - works

but when either task is run via lint-staged i get:

✖ turbo run lint:
 ERROR  run failed: error preparing engine: Could not find the following tasks in project: _path_to_repo_/.lintstagedrc.js, _path_to_repo/apps/cms/src/globals/Seo.ts, _path_to_repo/apps/cms/src/seed.ts, _path_to_repo/apps/cms/src/singles/About.ts, _path_to_repo/apps/cms/src/singles/Home.ts, _path_to_repo/apps/web/src/app/page.tsx, _path_to_repo/packages/config/eslint/react-internal.js, _path_to_repo/packages/ui/index.tsx

repo: https://github.com/magicspon/next-payloadcms-mono

@mehulkar
Copy link
Contributor

mehulkar commented Nov 3, 2023

@magicspon since this is already closed a long time ago, can you please open a new issue (thanks for the repro!)

@magicspon
Copy link

@mehulkar done -> #6358

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants