---
title: "SW03001: Generated identifier collision"
description: "Two different styles would receive the same generated name."
image: "https://stillwind.dev/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://stillwind.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# SW03001: Generated identifier collision

This error occurs when two different styles, refs, or animations would receive
the same generated name. The usual cause is a custom `naming` function that
returns the same name for different requests. A very short `hashLength` can also
cause it.

## Reported

**stillwind.config.ts**

```ts
import { defineConfig } from "stillwind/config";

export default defineConfig({
  projects: [
    {
      css: "./src/stillwind.css",
      files: ["src/**/*.tsx"],
      namingRevision: "1",
      naming: {
        utilityClass: () => "button",
      },
    },
  ],
});
```

```tsx
style("p-4");
style("p-8");
```

> SW03001: generated identifier collision: button

## Fixed

```ts title="stillwind.config.ts"
import { defineConfig } from "stillwind/config";

export default defineConfig({
  projects: [
    {
      css: "./src/stillwind.css",
      files: ["src/**/*.tsx"],
      namingRevision: "2",
      naming: {
        utilityClass: (_context, hash) => `button_${hash.toString("hex")}`,
      },
    },
  ],
});
```

```tsx
style("p-4");
style("p-8");
```

## How to fix

- Include the hash passed as the callback's second argument in the name, as in
  the example. This keeps the `button` prefix while distinguishing requests.
  Return `null` to use the default name for a request.
- If you use the default names, raise `hashLength`.
- Change `namingRevision` whenever you change a `naming` function.

Source: https://stillwind.dev/docs/errors/SW03001/index.mdx
