windmill-labs/windmill · error · Error

Username cannot be changed

Error message

Username cannot be changed

What it means

The user already exists remotely (keyed by email) but under a different username; Windmill usernames are immutable, so the sync refuses instead of attempting an update that would target the wrong account.

Source

Thrown at cli/src/commands/user/user.ts:170

      username: localUser.username,
    });
    user = {
      role: remoteUser.is_admin
        ? "admin"
        : remoteUser.operator
        ? "operator"
        : "developer",
      username: remoteUser.username,
      disabled: remoteUser.disabled,
    };
    log.debug(`User ${email} exists on remote`);
  } catch {
    log.debug(`User ${email} does not exist on remote`);
    //ignore
  }

  if (user && user.username !== localUser.username) {
    throw new Error("Username cannot be changed");
  }

  if (user) {
    if (isSuperset(localUser, user)) {
      log.debug(`User ${email} is up to date`);
      return;
    }
    log.debug(`User ${email} is not up-to-date, updating...`);
    try {
      await wmill.updateUser({
        workspace: workspace,
        username: localUser.username,
        requestBody: {
          is_admin: localUser.role === "admin",
          operator: localUser.role === "operator",
          disabled: localUser.disabled,
        },
      });

View on GitHub (pinned to e474e8803c)

Solutions

  1. Set the local username to match the existing remote account.
  2. If the local file is wrong, correct the username field rather than renaming the remote user.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cli/src/commands/user/user.ts:170 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/c3b872c09df08a68. Report an issue: GitHub.