Skip to content

v4.3.1 CLI fails with [Error: Invalid handle] when @source present #20231

Closed

Description

@alesvaupotic

What version of Tailwind CSS are you using?

v4.3.1

What build tool (or framework if it abstracts the build tool) are you using?

tailwindcss -i ./css/app.css -o ./static/app-dev.css --watch --verbose

What version of Node.js are you using?

v26.1.0

What browser are you using?

N/A

What operating system are you using?

Windows

Reproduction URL

https://github.com/reepolee/tw-431

Describe your issue

@import "tailwindcss";
@source "src/**/*";

When running CLI on css file with @source in it, build fails with error message

$ tailwindcss -i ./css/app.css -o ./static/app-dev.css --watch --verbose
≈ tailwindcss v4.3.1

node:internal/modules/run_main:107
    triggerUncaughtException(
    ^

[Error: Invalid handle]

Node.js v26.1.0
error: script "css:watch" exited with code 1

Activity

  1. RobinMalfait commented on Jun 13, 2026

    @RobinMalfait
    Contributor

    While this definitely shouldn't crash, the auto content detection starts from where you run the CLI, which is the root of the project so the src/ folder should already be included.

    That said, @source directives are relative to the file they are in, so that means that @source "src/**/*"; is relative to the css/ folder. Therefore css/src/ can't be found and crashes.

    I'll keep this open until I fix the crash, but the @source "src/**/*"; can be dropped and it should work as expected.

  2. RobinMalfait commented on Jun 13, 2026

    @RobinMalfait
    Contributor

    Both bun and node work fine on my end:

    Image
  3. alesvaupotic commented on Jun 13, 2026

    @alesvaupotic
    Author

    Thanks for looking into this, Robin. I acknowledge the bug in @source, but as you said, it still should not break the build process. I can confirm version 4.3.1 works without --watch.

    C:\Users\ales\code\tw-431>ver && node -v && bun -v
    
    Microsoft Windows [Version 10.0.19045.6456]
    v26.3.0
    1.4.0
    C:\Users\ales\code\tw-431>npm install -D @tailwindcss/cli@^4 && bun css:watch
    
    removed 2 packages, changed 5 packages, and audited 39 packages in 1s
    
    6 packages are looking for funding
      run `npm fund` for details
    
    found 0 vulnerabilities
    npm warn allow-scripts 1 package has install scripts not yet covered by allowScripts:
    npm warn allow-scripts   @parcel/[email protected] (install: node-gyp rebuild)
    npm warn allow-scripts
    npm warn allow-scripts Run `npm approve-scripts --allow-scripts-pending` to review, or `npm approve-scripts <pkg>` to allow.
    $ tailwindcss -i ./css/app.css -o ./static/app-dev.css --watch --verbose
    ≈ tailwindcss v4.3.1
    
    node:internal/modules/run_main:107
        triggerUncaughtException(
        ^
    
    [Error: Invalid handle]
    
    Node.js v26.3.0
    error: script "css:watch" exited with code 1
    C:\Users\ales\code\tw-431>tailwindcss -i ./css/app.css -o ./static/app-dev.css --verbose
    ≈ tailwindcss v4.3.1
    
    Done in 61ms
    C:\Users\ales\code\tw-431>npm install -D @tailwindcss/[email protected] && bun css:watch
    
    added 2 packages, changed 5 packages, and audited 41 packages in 1s
    
    6 packages are looking for funding
      run `npm fund` for details
    
    found 0 vulnerabilities
    npm warn allow-scripts 1 package has install scripts not yet covered by allowScripts:
    npm warn allow-scripts   @parcel/[email protected] (install: node-gyp rebuild)
    npm warn allow-scripts
    npm warn allow-scripts Run `npm approve-scripts --allow-scripts-pending` to review, or `npm approve-scripts <pkg>` to allow.
    $ tailwindcss -i ./css/app.css -o ./static/app-dev.css --watch --verbose
    ≈ tailwindcss v4.3.0
    
    (node:1572) [DEP0205] DeprecationWarning: `module.register()` is deprecated. Use `module.registerHooks()` instead.
    (Use `node --trace-deprecation ...` to show where the warning was created)
    Done in 87ms 
    
  4. added a commit that references this issue on Jun 15, 2026
    abc4670
  5. RobinMalfait commented on Jun 15, 2026

    @RobinMalfait
    Contributor

    Alright, This should be fixed by #20242, and will be available in the next release.

    You can already try it by using the insiders build:

    CLI:

    npm install tailwindcss@insiders @tailwindcss/cli@insiders

    PostCSS:

    npm install tailwindcss@insiders @tailwindcss/postcss@insiders

    Vite:

    npm install tailwindcss@insiders @tailwindcss/vite@insiders

    webpack:

    npm install tailwindcss@insiders @tailwindcss/webpack@insiders
  6. alesvaupotic commented on Jun 15, 2026

    @alesvaupotic
    Author

    Thanks a lot, that was quick 😃!

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

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