Skip to content

[Bug]: Tailwind CSS theme loading fails due to config schema mismatch #3218

@tealstream

Description

@tealstream

Describe the bug

Evidence dev server starts successfully (HTTP 200) but pages fail to render due to Tailwind CSS configuration errors. The @tailwindcss/vite plugin crashes with "Cannot convert undefined or null to object" during CSS generation.

Root Cause

The EvidenceConfigSchema in @evidence-dev/sdk/src/configuration/schemas/config.schema.js only validates three properties:

  • layout
  • plugins
  • deployment

However, loadThemesConfig() in @evidence-dev/tailwind expects appearance and theme sections from the config. When these sections are stripped by schema validation, the theme loader receives undefined/null, causing Tailwind v4 to crash.

Relevant code:

// @evidence-dev/sdk/src/configuration/schemas/config.schema.js
export const EvidenceConfigSchema = z.object({
  layout: z.string().or(z.literal(false).default(false)).optional(),
  plugins: PluginConfigSchema,
  deployment: DeploymentConfigSchema.optional().default({})
});
// NOTE: appearance and theme are NOT included

Expected Behavior

Pages should render with configured theme colors and appearance settings.

Actual Behavior

Multiple errors in logs:

[vite] Internal server error: Cannot convert undefined or null to object
  Plugin: @tailwindcss/vite:generate:serve
  File: /node_modules/@evidence-dev/tailwind/src/fonts.css
    at M.generate (file:///.../node_modules/@tailwindcss/vite/dist/index.mjs:1:5762)

Pages return HTTP 200 but fail to render due to missing CSS.

Steps to Reproduce

  1. Create a valid evidence.config.yaml with appearance and theme sections as documented
  2. Run npm install && npm run dev
  3. Observe Tailwind CSS errors in browser console and server logs

System Info

## Environment

- Evidence: 40.1.2
- @evidence-dev/tailwind: 3.0.10
- @evidence-dev/core-components: 5.2.2
- Node.js: 24.10.0
- Platform: macOS (Darwin 25.0.0)

## Configuration File


appearance:
  default: system
  switcher: true

theme:
  colorPalettes:
    default:
      light: [...]
      dark: [...]
  colorScales:
    default:
      light: [...]
      dark: [...]
  colors:
    primary:
      light: "#0F766E"
      dark: "#14B8A6"
    # ... other colors

Severity

blocking all usage of Evidence

Additional Information, or Workarounds

Attempted Workarounds

  1. Added package-lock=true to .npmrc (suggested in issue [Bug]: [vite] Internal server error: Cannot convert undefined or null to object #3156) - no effect
  2. Removed node_modules and clean reinstall - no effect
  3. Cleared npm cache and reinstalled - no effect
  4. Modified app.css to remove @config directive - reverted by Evidence build

Impact

Server runs but application is non-functional due to missing CSS. This blocks local development and testing.

Suggested Fix

Update EvidenceConfigSchema to include appearance and theme sections, or modify loadThemesConfig() to handle schema validation differently to preserve these sections.

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingto-reviewEvidence team to review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions