prestodb/presto · error · PrestoException

ALREADY_EXISTS

ALREADY_EXISTS

Error message

A factory with the name '' is already registered.

What it means

registerClientRequestFilterFactory guard: a ClientRequestFilterFactory with the same name was already registered (putIfAbsent returned a prior entry), so duplicate registration is refused with ALREADY_EXISTS.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/ClientRequestFilterManager.java:51

@ThreadSafe
public class ClientRequestFilterManager
{
    private Map<String, ClientRequestFilterFactory> factories = new ConcurrentHashMap<>();

    @GuardedBy("this")
    private volatile List<ClientRequestFilter> filters = ImmutableList.of();
    private final AtomicBoolean loaded = new AtomicBoolean();

    public void registerClientRequestFilterFactory(ClientRequestFilterFactory factory)
    {
        if (loaded.get()) {
            throw new PrestoException(INVALID_ARGUMENTS, "Cannot register factories after filters are loaded.");
        }

        String name = factory.getName();
        if (factories.putIfAbsent(name, factory) != null) {
            throw new PrestoException(ALREADY_EXISTS, "A factory with the name '" + name + "' is already registered.");
        }
    }

    public void loadClientRequestFilters()
    {
        if (!loaded.compareAndSet(false, true)) {
            throw new PrestoException(CONFIGURATION_INVALID, "loadClientRequestFilters can only be called once.");
        }

        filters = factories.values().stream()
                .map(factory -> factory.create())
                .collect(toImmutableList());
        factories = null;
    }

    public List<ClientRequestFilter> getClientRequestFilters()
    {
        return filters;

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Give the factory a unique name
  2. Remove the duplicate plugin or duplicate registration in the classpath
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/ClientRequestFilterManager.java:51 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/4c3a5e968e862ec9. Report an issue: GitHub.