{"record":{"id":"82b2c7243c212056","repo":"juanfont/headscale","slug":"cannot-edit-oidc-user","errorCode":null,"errorMessage":"cannot edit OIDC user","messagePattern":"cannot edit OIDC user","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hscontrol/db/users.go","lineNumber":92,"sourceCode":"\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif result := tx.Unscoped().Delete(&user); result.Error != nil {\n\t\treturn result.Error\n\t}\n\n\treturn nil\n}\n\nfunc (hsdb *HSDatabase) RenameUser(uid types.UserID, newName string) error {\n\treturn hsdb.Write(func(tx *gorm.DB) error {\n\t\treturn RenameUser(tx, uid, newName)\n\t})\n}\n\nvar ErrCannotChangeOIDCUser = errors.New(\"cannot edit OIDC user\")\n\n// RenameUser renames a [types.User]. Returns error if the [types.User] does\n// not exist or if another [types.User] exists with the new name.\nfunc RenameUser(tx *gorm.DB, uid types.UserID, newName string) error {\n\toldUser, err := GetUserByID(tx, uid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = util.ValidateUsername(newName); err != nil { //nolint:noinlineerr\n\t\treturn err\n\t}\n\n\tif oldUser.Provider == util.RegisterMethodOIDC {\n\t\treturn ErrCannotChangeOIDCUser\n\t}\n\n\toldUser.Name = newName","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/hscontrol/db/users.go#L74-L110","documentation":"Error \"cannot edit OIDC user\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at hscontrol/db/users.go:92 when the library encounters an invalid state.","commonSituations":"Users created via OIDC login are managed by the identity provider and cannot be edited locally. Change the user's attributes in the OIDC provider instead.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (cannot edit OIDC user); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (cannot edit OIDC user); retry the operation after fixing the input, configuration, or environment.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}