portainer/portainer · error · HandlerError

User already exists

Error message

User already exists

What it means

Error "User already exists" thrown in portainer/portainer.

Source

Thrown at api/http/handler/users/handler.go:19

package users

import (
	"errors"
	"net/http"

	portainer "github.com/portainer/portainer/api"
	"github.com/portainer/portainer/api/apikey"
	"github.com/portainer/portainer/api/dataservices"
	"github.com/portainer/portainer/api/http/security"
	"github.com/portainer/portainer/api/internal/authorization"
	"github.com/portainer/portainer/api/kubernetes/cli"
	httperror "github.com/portainer/portainer/pkg/libhttp/error"

	"github.com/gorilla/mux"
)

var (
	errUserAlreadyExists          = errors.New("User already exists")
	errAdminAlreadyInitialized    = errors.New("An administrator user already exists")
	errAdminCannotRemoveSelf      = errors.New("Cannot remove your own user account. Contact another administrator")
	errCannotRemoveLastLocalAdmin = errors.New("Cannot remove the last local administrator account")
	errCryptoHashFailure          = errors.New("Unable to hash data")
)

func hideFields(user *portainer.User) {
	user.Password = ""
}

// Handler is the HTTP handler used to handle user operations.
type Handler struct {
	*mux.Router
	bouncer                 security.BouncerService
	apiKeyService           apikey.APIKeyService
	DataStore               dataservices.DataStore
	CryptoService           portainer.CryptoService
	passwordStrengthChecker security.PasswordStrengthChecker

View on GitHub (pinned to 17e74456ff)

When it happens

Trigger: Thrown at api/http/handler/users/handler.go:19 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of portainer/portainer@17e74456ff (2026-08-26). Data as JSON: /api/errors/1fdb6832f4bd1b05. Report an issue: GitHub.