[GH-ISSUE #5879] user cannot login after create with createUser as admin #10370

Closed
opened 2026-04-13 06:28:13 -05:00 by GiteaMirror · 9 comments
Owner

Originally created by @rufique on GitHub (Nov 10, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/5879

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Ex.
install better-auth v

Current vs. Expected behavior

After creating a new user logged in as admin, using the following code

export async function createUser(data: {
  email: string;
  password: string;
  name: string;
  role: (typeof UserRoles)[number];
}) {
  try {
    const newUser = await auth.api.createUser({
      body: {
        email: data.email,
        password: data.password,
        name: data.name,
        role: data?.role ? data.role : "sales-agent",
      },
    });

    return { success: true, data: newUser };
  } catch (error) {
    console.error("Failed to create user:", error);
    return {
      success: false,
      error: error instanceof Error ? error.message : "Failed to create user",
    };
  }
}

the user is not able to log in, i get the error

[Better Auth]: Credential account not found { email: 'final@me.com' }

What version of Better Auth are you using?

1.3.23

System info

[Better Auth]: Credential account not found { email: 'final@me.com' }

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

Client

Auth config (if applicable)

const options = {
  database: drizzleAdapter(db, {
    provider: "mysql",
    schema: {
      user: schema.user,
      session: schema.session,
      account: schema.account,
      verification: schema.verification,
    },
  }),
  // account: {
  //   accountLinking: {
  //     enabled: true,
  //   },
  // },
  emailAndPassword: {
    enabled: true,
    requireEmailVerification: false,
    autoSignIn: false,
    minPasswordLength: 6,
    password: {
      hash: hashPassword,
      verify: verifyPassword,
    },
  },
  user: {
    deleteUser: {
      enabled: true,
    },
    additionalFields: {
      role: {
        type: "string",
        defaultValue: "sales-agent",
        required: true,
      },
    },
  },
  session: {
    expiresIn: 1000 * 60 * 15,
    cookieCache: {
      enabled: true,
      maxAge: 5 * 60,
    },
  },
  secret: process.env.NEXT_PUBLIC_BETTER_AUTH_SECRET!,
  baseURL:
    process.env.NEXT_PUBLIC_BETTER_AUTH_URL ||
    "http://localhost:3000/api/v1/auth",
  trustedOrigins: [
    process.env.NEXT_PUBLIC_BETTER_AUTH_URL ||
      "http://localhost:3000/api/v1/auth",
  ],
  telemetry: {
    debug: process.env.NODE_ENV === "development",
  },
  plugins: [
    nextCookies(),
    admin({
      adminRoles: ["admin", "manager"] as Role[],
      defaultRole: "sales-agent" as Role,
      roles: {
        ...createCustomRoles(), // this can be used to pass permission, even from the database.
      },
    }),
  ],
  advanced: {
    database: {
      generateId: false,
    },
    cookiePrefix: SESSION_COOKIE_PREFIX,
  },
} satisfies BetterAuthOptions;

Additional context

Example.
install better auth v1.3.23
install drizzle orm

Originally created by @rufique on GitHub (Nov 10, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/5879 ### Is this suited for github? - [ ] Yes, this is suited for github ### To Reproduce Ex. install better-auth v ### Current vs. Expected behavior After creating a new user logged in as admin, using the following code ``` export async function createUser(data: { email: string; password: string; name: string; role: (typeof UserRoles)[number]; }) { try { const newUser = await auth.api.createUser({ body: { email: data.email, password: data.password, name: data.name, role: data?.role ? data.role : "sales-agent", }, }); return { success: true, data: newUser }; } catch (error) { console.error("Failed to create user:", error); return { success: false, error: error instanceof Error ? error.message : "Failed to create user", }; } } ``` the user is not able to log in, i get the error ``` [Better Auth]: Credential account not found { email: 'final@me.com' } ``` ### What version of Better Auth are you using? 1.3.23 ### System info ```bash [Better Auth]: Credential account not found { email: 'final@me.com' } ``` ### Which area(s) are affected? (Select all that apply) Client ### Auth config (if applicable) ```typescript const options = { database: drizzleAdapter(db, { provider: "mysql", schema: { user: schema.user, session: schema.session, account: schema.account, verification: schema.verification, }, }), // account: { // accountLinking: { // enabled: true, // }, // }, emailAndPassword: { enabled: true, requireEmailVerification: false, autoSignIn: false, minPasswordLength: 6, password: { hash: hashPassword, verify: verifyPassword, }, }, user: { deleteUser: { enabled: true, }, additionalFields: { role: { type: "string", defaultValue: "sales-agent", required: true, }, }, }, session: { expiresIn: 1000 * 60 * 15, cookieCache: { enabled: true, maxAge: 5 * 60, }, }, secret: process.env.NEXT_PUBLIC_BETTER_AUTH_SECRET!, baseURL: process.env.NEXT_PUBLIC_BETTER_AUTH_URL || "http://localhost:3000/api/v1/auth", trustedOrigins: [ process.env.NEXT_PUBLIC_BETTER_AUTH_URL || "http://localhost:3000/api/v1/auth", ], telemetry: { debug: process.env.NODE_ENV === "development", }, plugins: [ nextCookies(), admin({ adminRoles: ["admin", "manager"] as Role[], defaultRole: "sales-agent" as Role, roles: { ...createCustomRoles(), // this can be used to pass permission, even from the database. }, }), ], advanced: { database: { generateId: false, }, cookiePrefix: SESSION_COOKIE_PREFIX, }, } satisfies BetterAuthOptions; ``` ### Additional context Example. install better auth v1.3.23 install drizzle orm
GiteaMirror added the lockedbug labels 2026-04-13 06:28:14 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 10, 2025):

Hi @rufique! I'm Dosu and I’m helping the better-auth team.

This issue usually means the credential/account record for the user wasn’t created, so login fails even though the user exists. In Better Auth, when you use auth.api.createUser (or the admin plugin), it should create both the user and the credential record (with the hashed password) needed for email/password login. If the schema for your user or account table is missing required fields (like role for the admin plugin), or if the schema isn’t passed directly to the Drizzle adapter, user creation or login can silently fail—especially with Drizzle ORM, which doesn’t always log these errors clearly [source].

Make sure:

  • Your user table has a role column (the admin plugin expects this, but the default migration doesn’t add it).
  • Your Drizzle adapter is passed the correct schema object, and all required fields (like name, role, etc.) are present and not null.
  • The password is being hashed and stored correctly (check your custom hash/verify functions).
  • No database constraints (like NOT NULL on a missing field) are causing silent failures.

If you’ve confirmed all of the above and still see the error, check your database directly to see if the account (credential) record for the new user actually exists. If it doesn’t, the user creation flow is being interrupted—likely due to a schema mismatch or missing required field [source].

Let me know if you want a checklist of schema fields or a sample migration for the role column.

To reply, just mention @dosu.


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

<!-- gh-comment-id:3511359126 --> @dosubot[bot] commented on GitHub (Nov 10, 2025): <!-- Greeting --> Hi @rufique! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> This issue usually means the credential/account record for the user wasn’t created, so login fails even though the user exists. In Better Auth, when you use `auth.api.createUser` (or the admin plugin), it should create both the user and the credential record (with the hashed password) needed for email/password login. If the schema for your user or account table is missing required fields (like `role` for the admin plugin), or if the schema isn’t passed directly to the Drizzle adapter, user creation or login can silently fail—especially with Drizzle ORM, which doesn’t always log these errors clearly [[source](https://github.com/better-auth/better-auth/issues/4795)]. Make sure: - Your `user` table has a `role` column (the admin plugin expects this, but the default migration doesn’t add it). - Your Drizzle adapter is passed the correct schema object, and all required fields (like `name`, `role`, etc.) are present and not null. - The password is being hashed and stored correctly (check your custom hash/verify functions). - No database constraints (like NOT NULL on a missing field) are causing silent failures. If you’ve confirmed all of the above and still see the error, check your database directly to see if the `account` (credential) record for the new user actually exists. If it doesn’t, the user creation flow is being interrupted—likely due to a schema mismatch or missing required field [[source](https://github.com/better-auth/better-auth/issues/1025)]. Let me know if you want a checklist of schema fields or a sample migration for the `role` column. <!-- 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/bb7714f0-ed8b-4a3f-ac2e-6fa4ec7b7f94?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/bb7714f0-ed8b-4a3f-ac2e-6fa4ec7b7f94?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/bb7714f0-ed8b-4a3f-ac2e-6fa4ec7b7f94?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/bb7714f0-ed8b-4a3f-ac2e-6fa4ec7b7f94?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/bb7714f0-ed8b-4a3f-ac2e-6fa4ec7b7f94?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/bb7714f0-ed8b-4a3f-ac2e-6fa4ec7b7f94?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/bb7714f0-ed8b-4a3f-ac2e-6fa4ec7b7f94?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/5879)
Author
Owner

@rufique commented on GitHub (Nov 10, 2025):

these are my schemas

export const UserRoles = ["admin", "sales-agent", 'sales-manager', 'manager'] as const;

export const user = mysqlTable(
  "user",
  {
    id: varchar("id", { length: 36 })
      .primaryKey()
      .$defaultFn(() => uuid()),
    name: text("name").notNull(),
    email: varchar("email", { length: 255 }).notNull().unique(),
    emailVerified: boolean("email_verified").default(false).notNull(),
    image: text("image"),
    role: mysqlEnum("role", UserRoles)
      .default("sales-agent")
      .notNull(),
    banned: boolean("banned").default(false),
    banReason: text("ban_reason"),
    banExpires: timestamp("ban_expires"),
    createdAt: timestamp("created_at").defaultNow().notNull(),
    updatedAt: timestamp("updated_at")
      .defaultNow()
      .$onUpdate(() => new Date())
      .notNull(),
  },
  (table) => [index("email_idx").on(table.email)]
);


export const account = mysqlTable(
  "account",
  {
    id: varchar("id", { length: 36 })
      .primaryKey()
      .$defaultFn(() => uuid()),
    accountId: text("account_id").notNull(),
    providerId: text("provider_id").notNull(),
    userId: varchar("user_id", { length: 36 })
      .notNull()
      .references(() => user.id, { onDelete: "cascade" }),
    accessToken: text("access_token"),
    refreshToken: text("refresh_token"),
    idToken: text("id_token"),
    accessTokenExpiresAt: timestamp("access_token_expires_at"),
    refreshTokenExpiresAt: timestamp("refresh_token_expires_at"),
    scope: text("scope"),
    password: text("password"),
    createdAt: timestamp("created_at").defaultNow().notNull(),
    updatedAt: timestamp("updated_at")
      .defaultNow()
      .$onUpdate(() => new Date())
      .notNull(),
  },
  (table) => [index("account_user_id_idx").on(table.userId)]
);

Apparently, the account is created, but it is linked to the currently logged-in user (admin), so when logging in, better-auth won't find the user->account. Which suggests that the creation method is referencing the session for linking

SignupEmail when logged out works as expected

<!-- gh-comment-id:3511445785 --> @rufique commented on GitHub (Nov 10, 2025): these are my schemas ``` export const UserRoles = ["admin", "sales-agent", 'sales-manager', 'manager'] as const; export const user = mysqlTable( "user", { id: varchar("id", { length: 36 }) .primaryKey() .$defaultFn(() => uuid()), name: text("name").notNull(), email: varchar("email", { length: 255 }).notNull().unique(), emailVerified: boolean("email_verified").default(false).notNull(), image: text("image"), role: mysqlEnum("role", UserRoles) .default("sales-agent") .notNull(), banned: boolean("banned").default(false), banReason: text("ban_reason"), banExpires: timestamp("ban_expires"), createdAt: timestamp("created_at").defaultNow().notNull(), updatedAt: timestamp("updated_at") .defaultNow() .$onUpdate(() => new Date()) .notNull(), }, (table) => [index("email_idx").on(table.email)] ); export const account = mysqlTable( "account", { id: varchar("id", { length: 36 }) .primaryKey() .$defaultFn(() => uuid()), accountId: text("account_id").notNull(), providerId: text("provider_id").notNull(), userId: varchar("user_id", { length: 36 }) .notNull() .references(() => user.id, { onDelete: "cascade" }), accessToken: text("access_token"), refreshToken: text("refresh_token"), idToken: text("id_token"), accessTokenExpiresAt: timestamp("access_token_expires_at"), refreshTokenExpiresAt: timestamp("refresh_token_expires_at"), scope: text("scope"), password: text("password"), createdAt: timestamp("created_at").defaultNow().notNull(), updatedAt: timestamp("updated_at") .defaultNow() .$onUpdate(() => new Date()) .notNull(), }, (table) => [index("account_user_id_idx").on(table.userId)] ); ``` Apparently, the account is created, but it is linked to the currently logged-in user (admin), so when logging in, better-auth won't find the user->account. Which suggests that the creation method is referencing the session for linking SignupEmail when logged out works as expected
Author
Owner

@dosubot[bot] commented on GitHub (Nov 10, 2025):

Based on the Better Auth code, when you create a user as an admin (using the admin plugin), the system should create a new user and explicitly link the account to that new user's ID—not the currently logged-in admin's ID. The session is only used to check permissions, not for account linkage. The relevant logic is here: after creating the user, it calls linkAccount with userId: user.id, where user is the newly created user, not the admin session user. This matches the behavior of the regular signup flow as well, which also links the account to the new user's ID, not the session user’s ID [source].

If the account is being linked to the admin user instead, something unexpected is happening—possibly a bug in how the user object is returned from your database, a schema mapping issue, or a mutation of arguments at runtime. Double-check that the user returned from createUser is the newly created user and that the payload sent to linkAccount uses the correct user ID. Also, confirm that your Drizzle adapter is using the correct schema and that there are no silent failures or mismatches in your DB layer.

If you want to debug further, log the values passed to linkAccount and the user returned from createUser to ensure they match the intended new user, not the admin. The codebase does not use the session user for account linkage in the admin createUser flow [source].

To reply, just mention @dosu.


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

<!-- gh-comment-id:3511468596 --> @dosubot[bot] commented on GitHub (Nov 10, 2025): <!-- Answer --> Based on the Better Auth code, when you create a user as an admin (using the admin plugin), the system should create a new user and explicitly link the account to that new user's ID—not the currently logged-in admin's ID. The session is only used to check permissions, not for account linkage. The relevant logic is here: after creating the user, it calls `linkAccount` with `userId: user.id`, where `user` is the newly created user, not the admin session user. This matches the behavior of the regular signup flow as well, which also links the account to the new user's ID, not the session user’s ID [[source](https://github.com/better-auth/better-auth/blob/7067b58d358af0fb28ce4d272513ef21186c253c/packages/better-auth/src/plugins/admin/admin.ts#L372-L507)]. If the account is being linked to the admin user instead, something unexpected is happening—possibly a bug in how the user object is returned from your database, a schema mapping issue, or a mutation of arguments at runtime. Double-check that the user returned from `createUser` is the newly created user and that the payload sent to `linkAccount` uses the correct user ID. Also, confirm that your Drizzle adapter is using the correct schema and that there are no silent failures or mismatches in your DB layer. If you want to debug further, log the values passed to `linkAccount` and the user returned from `createUser` to ensure they match the intended new user, not the admin. The codebase does not use the session user for account linkage in the admin createUser flow [[source](https://github.com/better-auth/better-auth/blob/7067b58d358af0fb28ce4d272513ef21186c253c/packages/better-auth/src/plugins/admin/admin.ts#L372-L507)]. <!-- 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/68a39370-7ff9-4aef-be82-2b8a7305aee4?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/68a39370-7ff9-4aef-be82-2b8a7305aee4?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/68a39370-7ff9-4aef-be82-2b8a7305aee4?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/68a39370-7ff9-4aef-be82-2b8a7305aee4?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/68a39370-7ff9-4aef-be82-2b8a7305aee4?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/68a39370-7ff9-4aef-be82-2b8a7305aee4?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/68a39370-7ff9-4aef-be82-2b8a7305aee4?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/5879)
Author
Owner

@rufique commented on GitHub (Nov 10, 2025):

@dosu I got this as newUser

user: {
    name: 'agent',
    email: 'a@me.com',
    emailVerified: false,
    image: null,
    createdAt: 2025-10-18T09:06:29.000Z,
    updatedAt: 2025-10-18T09:06:29.000Z,
    role: 'sales-agent',
    banned: false,
    banReason: null,
    banExpires: null,
    id: 'bb583072-f4ef-4d8d-903b-7f33b8322717'
  }

but my payload was

{
	"0": {
		"email": "anoth@me.com",
		"name": "anothe once",
		"password": "123456",
		"role": "sales-agent"
	}
}

Apparently, the account linked isn't even the one currently logged-in. It is also not the newly created account but another exisiting account

<!-- gh-comment-id:3511632341 --> @rufique commented on GitHub (Nov 10, 2025): @dosu I got this as newUser ``` user: { name: 'agent', email: 'a@me.com', emailVerified: false, image: null, createdAt: 2025-10-18T09:06:29.000Z, updatedAt: 2025-10-18T09:06:29.000Z, role: 'sales-agent', banned: false, banReason: null, banExpires: null, id: 'bb583072-f4ef-4d8d-903b-7f33b8322717' } ``` but my payload was ``` { "0": { "email": "anoth@me.com", "name": "anothe once", "password": "123456", "role": "sales-agent" } } ``` Apparently, the account linked isn't even the one currently logged-in. It is also not the newly created account but another exisiting account
Author
Owner

@dosubot[bot] commented on GitHub (Feb 9, 2026):

Hi, @rufique. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that creating a new user via createUser as an admin results in the new user being unable to log in due to a "Credential account not found" error.
  • The account record linked after creation does not correspond to the admin or the new user but to an unrelated existing account.
  • This suggests a potential bug or data mismatch in the account linkage process during user creation.
  • Further debugging of the user creation and account linking payloads is necessary to identify the root cause.

Next Steps:

  • Please confirm if this issue persists with the latest version of better-auth and provide any additional debugging information if available.
  • If the issue is still relevant, you can keep the discussion open by commenting on this issue; otherwise, I will automatically close it in 7 days.

Thank you for your understanding and contribution!

<!-- gh-comment-id:3872683856 --> @dosubot[bot] commented on GitHub (Feb 9, 2026): Hi, @rufique. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported that creating a new user via createUser as an admin results in the new user being unable to log in due to a "Credential account not found" error. - The account record linked after creation does not correspond to the admin or the new user but to an unrelated existing account. - This suggests a potential bug or data mismatch in the account linkage process during user creation. - Further debugging of the user creation and account linking payloads is necessary to identify the root cause. **Next Steps:** - Please confirm if this issue persists with the latest version of better-auth and provide any additional debugging information if available. - If the issue is still relevant, you can keep the discussion open by commenting on this issue; otherwise, I will automatically close it in 7 days. Thank you for your understanding and contribution!
Author
Owner

@dosubot[bot] commented on GitHub (Feb 9, 2026):

Hi, @rufique. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that creating a new user via createUser as an admin results in the new user being unable to log in due to a "Credential account not found" error.
  • The account record linked after creation does not correspond to the admin or the new user but to an unrelated existing account.
  • This suggests a potential bug or data mismatch in the account linkage process during user creation.
  • Further debugging of the user creation and account linking payloads is necessary to identify the root cause.

Next Steps:

  • Please confirm if this issue persists with the latest version of better-auth and provide any additional debugging information if available.
  • If the issue is still relevant, you can keep the discussion open by commenting on this issue; otherwise, I will automatically close it in 7 days.

Thank you for your understanding and contribution!

<!-- gh-comment-id:3872684088 --> @dosubot[bot] commented on GitHub (Feb 9, 2026): Hi, @rufique. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported that creating a new user via createUser as an admin results in the new user being unable to log in due to a "Credential account not found" error. - The account record linked after creation does not correspond to the admin or the new user but to an unrelated existing account. - This suggests a potential bug or data mismatch in the account linkage process during user creation. - Further debugging of the user creation and account linking payloads is necessary to identify the root cause. **Next Steps:** - Please confirm if this issue persists with the latest version of better-auth and provide any additional debugging information if available. - If the issue is still relevant, you can keep the discussion open by commenting on this issue; otherwise, I will automatically close it in 7 days. Thank you for your understanding and contribution!
Author
Owner

@dosubot[bot] commented on GitHub (Feb 9, 2026):

Hi, @rufique. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that creating a new user via createUser as an admin results in the new user being unable to log in due to a "Credential account not found" error.
  • The account record linked after creation does not correspond to the admin or the new user but to an unrelated existing account.
  • This suggests a potential bug or data mismatch in the account linkage process during user creation.
  • Further debugging of the user creation and account linking payloads is necessary to identify the root cause.

Next Steps:

  • Please confirm if this issue persists with the latest version of better-auth and provide any additional debugging information if available.
  • If the issue is still relevant, you can keep the discussion open by commenting on this issue; otherwise, I will automatically close it in 7 days.

Thank you for your understanding and contribution!

<!-- gh-comment-id:3872684571 --> @dosubot[bot] commented on GitHub (Feb 9, 2026): Hi, @rufique. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported that creating a new user via createUser as an admin results in the new user being unable to log in due to a "Credential account not found" error. - The account record linked after creation does not correspond to the admin or the new user but to an unrelated existing account. - This suggests a potential bug or data mismatch in the account linkage process during user creation. - Further debugging of the user creation and account linking payloads is necessary to identify the root cause. **Next Steps:** - Please confirm if this issue persists with the latest version of better-auth and provide any additional debugging information if available. - If the issue is still relevant, you can keep the discussion open by commenting on this issue; otherwise, I will automatically close it in 7 days. Thank you for your understanding and contribution!
Author
Owner

@dosubot[bot] commented on GitHub (Feb 9, 2026):

Hi, @rufique. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that creating a new user via createUser as an admin results in the new user being unable to log in due to a "Credential account not found" error.
  • The account record linked after creation does not correspond to the admin or the new user but to an unrelated existing account.
  • This suggests a potential bug or data mismatch in the account linkage process during user creation.
  • Further debugging of the user creation and account linking payloads is necessary to identify the root cause.

Next Steps:

  • Please confirm if this issue persists with the latest version of better-auth and provide any additional debugging information if available.
  • If the issue is still relevant, you can keep the discussion open by commenting on this issue; otherwise, I will automatically close it in 7 days.

Thank you for your understanding and contribution!

<!-- gh-comment-id:3872685218 --> @dosubot[bot] commented on GitHub (Feb 9, 2026): Hi, @rufique. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported that creating a new user via createUser as an admin results in the new user being unable to log in due to a "Credential account not found" error. - The account record linked after creation does not correspond to the admin or the new user but to an unrelated existing account. - This suggests a potential bug or data mismatch in the account linkage process during user creation. - Further debugging of the user creation and account linking payloads is necessary to identify the root cause. **Next Steps:** - Please confirm if this issue persists with the latest version of better-auth and provide any additional debugging information if available. - If the issue is still relevant, you can keep the discussion open by commenting on this issue; otherwise, I will automatically close it in 7 days. Thank you for your understanding and contribution!
Author
Owner

@Abdul-Asa commented on GitHub (Mar 6, 2026):

I think its because when you create a new user from admin, their email is still unverified so you need to send them a verification email

<!-- gh-comment-id:4010962608 --> @Abdul-Asa commented on GitHub (Mar 6, 2026): I think its because when you create a new user from admin, their email is still unverified so you need to send them a verification email
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#10370