{"record":{"id":"daabc9b9d743ec43","repo":"prestodb/presto","slug":"event-listener-s-is-already-registered","errorCode":null,"errorMessage":"Event listener '%s' is already registered","messagePattern":"Event listener '(.+?)' is already registered","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/eventlistener/EventListenerManager.java","lineNumber":71,"sourceCode":"    private static final String EVENT_LISTENER_PROPERTY_NAME = \"event-listener.name\";\n    private final List<File> configFiles;\n    private final Map<String, EventListenerFactory> eventListenerFactories = new ConcurrentHashMap<>();\n    private final AtomicReference<List<EventListener>> configuredEventListeners =\n            new AtomicReference<>(ImmutableList.of());\n    private final AtomicBoolean loading = new AtomicBoolean(false);\n\n    @Inject\n    public EventListenerManager(EventListenerConfig config)\n    {\n        this.configFiles = ImmutableList.copyOf(config.getEventListenerFiles());\n    }\n\n    public void addEventListenerFactory(EventListenerFactory eventListenerFactory)\n    {\n        requireNonNull(eventListenerFactory, \"eventListenerFactory is null\");\n\n        if (eventListenerFactories.putIfAbsent(eventListenerFactory.getName(), eventListenerFactory) != null) {\n            throw new IllegalArgumentException(format(\"Event listener '%s' is already registered\", eventListenerFactory.getName()));\n        }\n    }\n\n    public void loadConfiguredEventListeners()\n    {\n        checkState(loading.compareAndSet(false, true), \"Event listeners already loaded\");\n        List<File> configFiles = this.configFiles;\n        if (configFiles.isEmpty()) {\n            if (!Files.exists(EVENT_LISTENER_CONFIGURATION)) {\n                return;\n            }\n            configFiles = ImmutableList.of(EVENT_LISTENER_CONFIGURATION.toFile());\n        }\n        configFiles.forEach(this::createEventListener);\n    }\n\n    private void createEventListener(File configFile)\n    {","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/eventlistener/EventListenerManager.java#L53-L89","documentation":"EventListenerManager.addEventListenerFactory received a second event listener factory with the same name; names must be unique across plugins and the duplicate registration is rejected with ALREADY_EXISTS.","triggerScenarios":"Thrown at presto-main-base/src/main/java/com/facebook/presto/eventlistener/EventListenerManager.java:71 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rename one of the event listener factories","Check for duplicated plugin jars on the classpath"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}