Error: Cannot apply unknown utility class

After upgrading from Tailwindcss v3.3 to v4.1, I am getting the following error:

$ mix assets.build
...
Generated utilx app
Error: Cannot apply unknown utility class: checked:border-brand-500

The assets/css/app.css contains:

@import "tailwindcss"
@import "../../deps/utilx/assets/inputs.css";

In the Tailwind 4.x upgrade guide they recommend using the @reference /path/to/app.css in the imported file. However, including such a reference results in two problems:

  1. A circular dependency (app.css → inputs.css → app.css)
$ mix assets.build
Error: Exceeded maximum recursion depth while resolving `./theme.css` in `/$bunfs/root`)
  1. From the design point of view it’s unclear why the stand-alone dependency application should reference another (parent) application’s css.

Has anyone found a way to upgrade to Tailwindcss 4.x?

This question was answered on the tailwincss github site:

Hope others find it useful when migrating to Tailwindcss 4.x.

1 Like