Skip to content

[v4] Tailwind fails to compile if there is no parent directory #15987

Closed
@eirikhanasand

Description

@eirikhanasand

What version of Tailwind CSS are you using?
v4

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

What version of Node.js are you using?
v22.9.0

What browser are you using?
N/A

What operating system are you using?
macOS but running in Docker with node:alpine

Reproduction URL
All thats required is tailwind v4 and a Dockerfile without a WORKDIR. Ive created a public repo that showcases the issue.
https://github.com/eirikhanasand/tailwindnoparentdirbug

Describe your issue
When using tailwindcss in a Docker container without a WORKDIR statement tailwind will panic at crates/oxide/src/scanner/detect_sources.rs:117:78 due to calling Option::unwrap() on a None value as it fails to find a parent directory:

if forced_static_directories.contains(&entry.path().parent().unwrap().to_path_buf())

 > [tailwindnoparentdirbug 8/8] RUN npm run build:                                                                                                                                              
0.165                                                                                                                                                                            
0.165 > tailwindnoparentdirbug@0.1.0 build                                                                                                                                                      
0.165 > next build                                                                                                                                                               
0.165                                                                                                                                                                            
0.687 Attention: Next.js now collects completely anonymous telemetry regarding usage.
0.688 This information is used to shape Next.js' roadmap and prioritize features.
0.688 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
0.688 https://nextjs.org/telemetry
0.688 
0.791     Next.js 15.1.6
0.791 
0.853    Creating an optimized production build ...
9.142 thread '<unnamed>' panicked at crates/oxide/src/scanner/detect_sources.rs:117:78:
9.142 called `Option::unwrap()` on a `None` value
9.142 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
9.146 fatal runtime error: failed to initiate panic, error 2908277840
[+] Running 0/1rker exited with code: null and signal: SIGABRT
  Service tailwindnoparentdirbug  Building                                                                                                                                         10.4s 
failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1

Metadata

Metadata

Assignees

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