prestodb/presto · error · IllegalArgumentException

Session property configuration manager '%s' is already regis

Error message

Session property configuration manager '%s' is already registered

What it means

SessionPropertyDefaults.addConfigurationManagerFactory registers SessionPropertyConfigurationManagerFactory instances by name in a map using putIfAbsent. If a factory with the same getName() is already present, it throws IllegalArgumentException — only one factory per name is allowed.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/server/SessionPropertyDefaults.java:67

    private static final Path SESSION_PROPERTY_CONFIGURATION = Paths.get("etc/session-property-config.properties");
    private static final String SESSION_PROPERTY_MANAGER_NAME = "session-property-config.configuration-manager";

    private final SessionPropertyConfigurationManagerContext configurationManagerContext;
    private final Map<String, SessionPropertyConfigurationManagerFactory> factories = new ConcurrentHashMap<>();
    private final AtomicReference<SessionPropertyConfigurationManager> delegate = new AtomicReference<>();
    private final String prestoServerVersion;

    @Inject
    public SessionPropertyDefaults(NodeInfo nodeInfo, NodeVersion nodeVersion)
    {
        this.configurationManagerContext = new SessionPropertyConfigurationManagerContextInstance(nodeInfo.getEnvironment());
        this.prestoServerVersion = requireNonNull(nodeVersion.getVersion(), "prestoServerVersion is null");
    }

    public void addConfigurationManagerFactory(SessionPropertyConfigurationManagerFactory sessionConfigFactory)
    {
        if (factories.putIfAbsent(sessionConfigFactory.getName(), sessionConfigFactory) != null) {
            throw new IllegalArgumentException(format("Session property configuration manager '%s' is already registered", sessionConfigFactory.getName()));
        }
    }

    public void loadConfigurationManager()
            throws IOException
    {
        if (!Files.exists(SESSION_PROPERTY_CONFIGURATION)) {
            return;
        }

        Map<String, String> properties = loadProperties(SESSION_PROPERTY_CONFIGURATION.toFile());
        checkArgument(!isNullOrEmpty(properties.get(SESSION_PROPERTY_MANAGER_NAME)),
                "Session property configuration %s does not contain %s",
                SESSION_PROPERTY_CONFIGURATION,
                SESSION_PROPERTY_MANAGER_NAME);

        loadConfigurationManager(properties);
    }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Remove the duplicate plugin so only one provider of that configuration-manager name is installed
  2. Ensure the factory's getName() is unique among registered factories
  3. In tests, construct a new SessionPropertyDefaults per case or register once in setup
  4. Make startup idempotent by checking the name before registering

Example fix

// before
sessionPropertyDefaults.addConfigurationManagerFactory(factory);
// after
if (!sessionPropertyDefaultsHasFactory(factory)) {
    sessionPropertyDefaults.addConfigurationManagerFactory(factory);
}
Defensive patterns

Strategy: validation

Validate before calling

// ensure uniqueness before registration
Set<String> seen = new HashSet<>();
if (!seen.add(factory.getName())) { skip-or-log; }
else { defaults.addConfigurationManagerFactory(factory); }

Type guard

boolean isRegisterable(SessionPropertyConfigurationManagerFactory f, Set<String> registeredNames) {
    return f.getName() != null && !registeredNames.contains(f.getName());
}

Try / catch

try {
    defaults.addConfigurationManagerFactory(factory);
} catch (IllegalArgumentException e) {
    log.warn("Session property configuration manager already registered: {}", factory.getName());
}

Prevention

When it happens

Trigger: Calling addConfigurationManagerFactory twice with factories whose names collide; typically the same session property configuration manager plugin registered twice (duplicate plugin install) or test setup (e.g. testApplyDefaultProperties) registering the factory more than once against a shared manager.

Common situations: Duplicate plugin jar deployments on the coordinator; initializing SessionPropertyDefaults multiple times in one process; test fixtures that share a manager across cases without resetting it.

Related errors


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