apache/seatunnel · error · java.lang.RuntimeException

Could not load service provider for event handlers.

Error message

Could not load service provider for event handlers.

What it means

Logged/handled in loadEventHandlers when java.util.ServiceLoader fails while discovering EventHandler SPI implementations on the given classloader — typically a malformed META-INF/services file, a class that fails static initialization, or a missing dependency of a handler class. The faulty input is the SPI metadata or handler class on the classpath, not the caller's arguments.

Solutions

  1. Inspect the ServiceConfigurationError cause to identify the offending handler class or services file
  2. Fix or remove the broken META-INF/services/org.apache.seatunnel.api.event.EventHandler entry
  3. Verify the handler's dependencies are on the classloader passed to loadEventHandlers
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/event/EventProcessor.java:36 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/9268f8c3e7aec1b6. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/event/EventProcessor.java:36

package org.apache.seatunnel.api.event;

import java.util.LinkedList;
import java.util.List;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;

public interface EventProcessor extends AutoCloseable {
    void process(Event event);

    static List<EventHandler> loadEventHandlers(ClassLoader classLoader) {
        try {
            List<EventHandler> result = new LinkedList<>();
            ServiceLoader.load(EventHandler.class, classLoader)
                    .iterator()
                    .forEachRemaining(result::add);
            return result;
        } catch (ServiceConfigurationError e) {
            throw new RuntimeException("Could not load service provider for event handlers.", e);
        }
    }

    static void close(List<EventHandler> handlers) throws Exception {
        if (handlers != null) {
            for (EventHandler handler : handlers) {
                handler.close();
            }
        }
    }
}

View on GitHub (pinned to cf67b549a7)