Organization Plugin Slug Requirement #2038

Closed
opened 2026-03-13 09:22:28 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @bytaesu on GitHub (Sep 29, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

In the Organization creation endpoint body, slug is required, but it’s optional in the database schema. I’m not sure if this is intentional or something missing.

Since changing either the DB or the API would be a structural change, I opened an issue instead of a PR.

https://github.com/better-auth/better-auth/blob/canary/packages/better-auth/src/plugins/organization/schema.ts#L15

Current vs. Expected behavior

The slug requirement in Organization creation and in the database needs to be consistent.

What version of Better Auth are you using?

1.3.12

System info

MacOS

Which area(s) are affected? (Select all that apply)

Backend, Documentation

Originally created by @bytaesu on GitHub (Sep 29, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce In the Organization creation endpoint body, `slug` is required, but it’s optional in the database schema. I’m not sure if this is intentional or something missing. Since changing either the DB or the API would be a structural change, I opened an issue instead of a PR. https://github.com/better-auth/better-auth/blob/canary/packages/better-auth/src/plugins/organization/schema.ts#L15 ### Current vs. Expected behavior The `slug` requirement in Organization creation and in the database needs to be consistent. ### What version of Better Auth are you using? 1.3.12 ### System info ```bash MacOS ``` ### Which area(s) are affected? (Select all that apply) Backend, Documentation
GiteaMirror added the documentation label 2026-03-13 09:22:28 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 29, 2025):

The requirement for the slug field in the Organization creation API is intentional—it's meant to be a mandatory, unique identifier for organizations. The database schema should also require slug by default. If you're seeing it as optional, it's likely due to the organization plugin not being properly added to your Better Auth configuration. Make sure your config includes the organization plugin in the plugins array, like:

import { organization } from "better-auth/plugins";
export const auth = betterAuth({
  plugins: [organization()],
  emailAndPassword: { enabled: true },
});

The official documentation and tests confirm that slug is required in both the API and the database schema, and that uniqueness is enforced during creation. The plugin allows schema customization, but unless you explicitly change it, slug should be required and consistent across both layers. If your schema still shows slug as optional, double-check your plugin setup and consider regenerating your schema after updating your config. For more details, see the organization plugin docs and related issue.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 29, 2025): <!-- Answer --> The requirement for the `slug` field in the Organization creation API is intentional—it's meant to be a mandatory, unique identifier for organizations. The database schema should also require `slug` by default. If you're seeing it as optional, it's likely due to the organization plugin not being properly added to your Better Auth configuration. Make sure your config includes the organization plugin in the `plugins` array, like: ```typescript import { organization } from "better-auth/plugins"; export const auth = betterAuth({ plugins: [organization()], emailAndPassword: { enabled: true }, }); ``` The official documentation and tests confirm that `slug` is required in both the API and the database schema, and that uniqueness is enforced during creation. The plugin allows schema customization, but unless you explicitly change it, `slug` should be required and consistent across both layers. If your schema still shows `slug` as optional, double-check your plugin setup and consider regenerating your schema after updating your config. For more details, see the [organization plugin docs](https://github.com/better-auth/better-auth/blob/f6cbdcc84ee5d2971fdcc8b23ff7c174f88cf45b/docs/content/docs/plugins/organization.mdx) and [related issue](https://github.com/better-auth/better-auth/issues/4869). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/a5ba5a04-fcde-4439-a63e-28b038d6b9ab?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/a5ba5a04-fcde-4439-a63e-28b038d6b9ab?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/a5ba5a04-fcde-4439-a63e-28b038d6b9ab?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/a5ba5a04-fcde-4439-a63e-28b038d6b9ab?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/a5ba5a04-fcde-4439-a63e-28b038d6b9ab?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/a5ba5a04-fcde-4439-a63e-28b038d6b9ab?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/a5ba5a04-fcde-4439-a63e-28b038d6b9ab?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/4965)
Author
Owner

@bytaesu commented on GitHub (Sep 29, 2025):

Rewrite

@bytaesu commented on GitHub (Sep 29, 2025): Rewrite
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2038