Skip to content

Error: Tailwind CSS: Cannot read properties of undefined (reading 'type') #1362

Closed
@ehsan18t

Description

@ehsan18t

What version of Tailwind CSS are you using?

v4.1.6

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

Astro 5.7.12, React 19.1.0

What version of Node.js are you using?

v22.15.0

What browser are you using?

EDGE, FireFox (not relevant to the issue)

What operating system are you using?

Windows 11 24H2 IoT LTSC (not relevant to the issue)

Reproduction URL

https://github.com/ehsan18t/tw-bug-repo

Describe your issue

I don't get any suggestions from intellisense at all. I tried so many things to fix it but didn't work at all. I get errors on output tab in vscode (attached below). After change things here and there in src/styles/global.css it goes away but suggestion still doesn't work most of the time. But again, sometimes it does. If I remove everything from @theme and everything under it, everything starts working. I checked multiple time if anything is wrong with theme but it's not (according to official docs).

Locating server…
Booting server...
Setting up server…
Listening for messages…
Searching for Tailwind CSS projects in the workspace's folders.
{"tailwind":{"version":"4.1.5","features":["css-at-theme","layer:base","content-list","source-inline","source-not"],"isDefaultVersion":false},"path":"c:/Users/Ehsan/Desktop/tw-bug-repo/src/styles/global.css"}
[Global] Creating projects: [{"folder":"C:\\Users\\Ehsan\\Desktop\\tw-bug-repo","config":"C:/Users/Ehsan/Desktop/tw-bug-repo/src/styles/global.css","selectors":[{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/src/styles/global.css","priority":0},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/.gitattributes","priority":1},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/.prettierrc.mjs","priority":1},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/.vscode/extensions.json","priority":1},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/.vscode/launch.json","priority":1},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/.vscode/settings.json","priority":1},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/astro.config.mjs","priority":1},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/package.json","priority":1},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/public/favicon.svg","priority":1},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/README.md","priority":1},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/src/layouts/MainLayout.astro","priority":1},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/src/pages/index.astro","priority":1},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/src/pages/robots.txt.ts","priority":1},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/src/styles/global.css","priority":1},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/tsconfig.json","priority":1},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/*","priority":1},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/.vscode/**/*.{,aspx,astro,cjs,css,cts,eex,erb,gjs,gts,haml,handlebars,hbs,heex,html,jade,js,json,jsx,liquid,md,mdx,mjs,mts,mustache,njk,nunjucks,php,pug,py,razor,rb,rhtml,rs,slim,svelte,svg,tpl,ts,tsx,twig,vue}","priority":1},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/src/**/*.{,aspx,astro,cjs,css,cts,eex,erb,gjs,gts,haml,handlebars,hbs,heex,html,jade,js,json,jsx,liquid,md,mdx,mjs,mts,mustache,njk,nunjucks,php,pug,py,razor,rb,rhtml,rs,slim,svelte,svg,tpl,ts,tsx,twig,vue}","priority":1},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/src/styles/**","priority":2},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/**","priority":4},{"pattern":"C:/Users/Ehsan/Desktop/tw-bug-repo/**","priority":5}],"user":false,"tailwind":{"version":"4.1.5","features":["css-at-theme","layer:base","content-list","source-inline","source-not"],"isDefaultVersion":false}}]
[Global] Preparing projects...
[Global] Initializing projects...
[src\styles\global.css] Initializing...
[Global] Adding watch patterns: C:/Users/Ehsan/Desktop/tw-bug-repo/src/styles/global.css, C:/Users/Ehsan/Desktop/tw-bug-repo/src/styles, C:/Users/Ehsan/Desktop/tw-bug-repo/src, C:/Users/Ehsan/Desktop/tw-bug-repo, C:/Users/Ehsan/Desktop, C:/Users/Ehsan, C:/Users, C:/
[src\styles\global.css] supported features: ["css-at-theme","layer:base","content-list","source-inline","source-not"]
[src\styles\global.css] Loaded tailwindcss v4.1.5: c:\Users\Ehsan\Desktop\tw-bug-repo\node_modules\tailwindcss
[src\styles\global.css] Building...
[Global] Adding watch patterns: c:\Users\Ehsan\Desktop\tw-bug-repo\node_modules\tailwindcss\index.css
[Error - 2:59:46 PM] Tailwind CSS: Cannot read properties of undefined (reading 'type')
TypeError: Cannot read properties of undefined (reading 'type')
    at Bee (c:\Users\Ehsan\.vscode\extensions\bradlc.vscode-tailwindcss-0.14.16\dist\tailwindServer.js:1775:777)
    at q8e (c:\Users\Ehsan\.vscode\extensions\bradlc.vscode-tailwindcss-0.14.16\dist\tailwindServer.js:1775:1235)
    at W8e (c:\Users\Ehsan\.vscode\extensions\bradlc.vscode-tailwindcss-0.14.16\dist\tailwindServer.js:1775:1335)
    at c:\Users\Ehsan\.vscode\extensions\bradlc.vscode-tailwindcss-0.14.16\dist\tailwindServer.js:1775:71808
    at String.replace (<anonymous>)
    at o6e (c:\Users\Ehsan\.vscode\extensions\bradlc.vscode-tailwindcss-0.14.16\dist\tailwindServer.js:1775:71747)
    at YUe (c:\Users\Ehsan\.vscode\extensions\bradlc.vscode-tailwindcss-0.14.16\dist\tailwindServer.js:1775:69177)
    at c:\Users\Ehsan\.vscode\extensions\bradlc.vscode-tailwindcss-0.14.16\dist\tailwindServer.js:1775:69614
    at Array.flatMap (<anonymous>)
    at c:\Users\Ehsan\.vscode\extensions\bradlc.vscode-tailwindcss-0.14.16\dist\tailwindServer.js:1775:69603
[Global] Initialized 1 projects


EDIT:
OK, I've just found out if I don't use rgb() inside @theme everything works. Even though using rgb() doesn't give any error on the tailwindcss side and works perfectly but intellisense doesn't work. I've added global-works.css, removing global.css file and replacing it inside src/layouts/MainLayout.astro make the intellisense works perfectly.

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