{"record":{"id":"c3b872c09df08a68","repo":"windmill-labs/windmill","slug":"username-cannot-be-changed","errorCode":null,"errorMessage":"Username cannot be changed","messagePattern":"Username cannot be changed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/user/user.ts","lineNumber":170,"sourceCode":"      username: localUser.username,\n    });\n    user = {\n      role: remoteUser.is_admin\n        ? \"admin\"\n        : remoteUser.operator\n        ? \"operator\"\n        : \"developer\",\n      username: remoteUser.username,\n      disabled: remoteUser.disabled,\n    };\n    log.debug(`User ${email} exists on remote`);\n  } catch {\n    log.debug(`User ${email} does not exist on remote`);\n    //ignore\n  }\n\n  if (user && user.username !== localUser.username) {\n    throw new Error(\"Username cannot be changed\");\n  }\n\n  if (user) {\n    if (isSuperset(localUser, user)) {\n      log.debug(`User ${email} is up to date`);\n      return;\n    }\n    log.debug(`User ${email} is not up-to-date, updating...`);\n    try {\n      await wmill.updateUser({\n        workspace: workspace,\n        username: localUser.username,\n        requestBody: {\n          is_admin: localUser.role === \"admin\",\n          operator: localUser.role === \"operator\",\n          disabled: localUser.disabled,\n        },\n      });","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/user/user.ts#L152-L188","documentation":"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.","triggerScenarios":"Thrown at cli/src/commands/user/user.ts:170 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the local username to match the existing remote account.","If the local file is wrong, correct the username field rather than renaming the remote user."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}