portainer/portainer · error · httperror.HandlerError

A stack with the name '%s' is already running on endpoint '%

Error message

A stack with the name '%s' is already running on endpoint '%s'

What it means

Error "A stack with the name '%s' is already running on endpoint '%s'" thrown in portainer/portainer.

Source

Thrown at api/http/handler/stacks/stack_migrate.go:150

	stack.EndpointID = portainer.EndpointID(payload.EndpointID)
	if payload.SwarmID != "" {
		stack.SwarmID = payload.SwarmID
	}

	oldName := stack.Name
	if payload.Name != "" {
		stack.Name = payload.Name
	}

	isUnique, err := handler.checkUniqueStackNameInDocker(targetEndpoint, stack.Name, stack.ID, stack.SwarmID != "")
	if err != nil {
		return httperror.InternalServerError("Unable to check for name collision", err)
	}

	if !isUnique {
		errorMessage := fmt.Sprintf("A stack with the name '%s' is already running on endpoint '%s'", stack.Name, targetEndpoint.Name)
		return httperror.Conflict(errorMessage, errors.New(errorMessage))
	}

	migrationError := handler.migrateStack(r, stack, targetEndpoint)
	if migrationError != nil {
		return migrationError
	}

	newName := stack.Name
	stack.Name = oldName
	if err := handler.teardownService.RemoveResources(context.TODO(), securityContext.UserID, stack, endpoint); err != nil {
		return httperror.InternalServerError(err.Error(), err)
	}

	stack.Name = newName
	if err := handler.DataStore.Stack().Update(stack.ID, stack); err != nil {
		return httperror.InternalServerError("Unable to persist the stack changes inside the database", err)
	}

View on GitHub (pinned to 17e74456ff)

When it happens

Trigger: Thrown at api/http/handler/stacks/stack_migrate.go:150 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/e8ce82121568b204. Report an issue: GitHub.