juanfont/headscale · error

cannot edit OIDC user

Error message

cannot edit OIDC user

What it means

Error "cannot edit OIDC user" thrown in juanfont/headscale.

Source

Thrown at hscontrol/db/users.go:92

		if err != nil {
			return err
		}
	}

	if result := tx.Unscoped().Delete(&user); result.Error != nil {
		return result.Error
	}

	return nil
}

func (hsdb *HSDatabase) RenameUser(uid types.UserID, newName string) error {
	return hsdb.Write(func(tx *gorm.DB) error {
		return RenameUser(tx, uid, newName)
	})
}

var ErrCannotChangeOIDCUser = errors.New("cannot edit OIDC user")

// RenameUser renames a [types.User]. Returns error if the [types.User] does
// not exist or if another [types.User] exists with the new name.
func RenameUser(tx *gorm.DB, uid types.UserID, newName string) error {
	oldUser, err := GetUserByID(tx, uid)
	if err != nil {
		return err
	}

	if err = util.ValidateUsername(newName); err != nil { //nolint:noinlineerr
		return err
	}

	if oldUser.Provider == util.RegisterMethodOIDC {
		return ErrCannotChangeOIDCUser
	}

	oldUser.Name = newName

View on GitHub (pinned to 565fd254d0)

Solutions

  1. 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.

Example fix

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.

When it happens

Trigger: Thrown at hscontrol/db/users.go:92 when the library encounters an invalid state.

Common situations: 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.


AI-assisted analysis of juanfont/headscale@565fd254d0 (2026-08-15). Data as JSON: /api/errors/82b2c7243c212056. Report an issue: GitHub.