prestodb/presto · critical · RuntimeException

Failed to build plugin classloaders

Error message

Failed to build plugin classloaders

What it means

FlightShimPluginManager.createPluginClassLoaders builds classloaders for plugin packages. Any exception while constructing those classloaders is rethrown as a RuntimeException('Failed to build plugin classloaders', e). This aborts server startup because the shim cannot isolate/load plugin SPI classes.

Source

Thrown at presto-flight-shim/src/main/java/com/facebook/presto/flightshim/FlightShimPluginManager.java:237

        {
            return codecTransactionHandle;
        }
    }

    private List<PluginManagerUtil.PluginClassLoaderHandle> createPluginClassLoaders()
    {
        try {
            return PluginManagerUtil.buildClassLoaders(
                    installedPluginsDir,
                    plugins,
                    resolver,
                    SPI_PACKAGES,
                    null,
                    SERVICES_FILE,
                    getClass().getClassLoader());
        }
        catch (Exception e) {
            throw new RuntimeException("Failed to build plugin classloaders", e);
        }
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Inspect the cause stack trace to find the failing plugin directory/jar or missing resource
  2. Fix file permissions and ensure the plugin directory layout is correct and jars are not corrupt
  3. Verify the deployment includes all required plugin jars and services files for the shim

Example fix

// before (deployment)
plugin.dir=/nonexistent/path
// after
plugin.dir=/opt/presto-server/plugin  (exists, readable, contains plugin jars)
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight: ensure plugin dir exists and is readable before server start
File dir = new File(pluginDir);
if (!dir.isDirectory() || !dir.canRead()) throw new IllegalStateException("Bad plugin dir: " + pluginDir);

Try / catch

try { server.start(); }
catch (RuntimeException e) {
  if ("Failed to build plugin classloaders".equals(e.getMessage())) {
    log.fatal("Plugin classloader failure", e.getCause()); // inspect cause for IO/permission errors
  }
  throw e;
}

Prevention

When it happens

Trigger: IOException/other exception while scanning plugin directories, reading services files, or creating URLClassLoader instances for SPI packages during createPluginClassLoaders.

Common situations: Missing or unreadable plugin directory; corrupt plugin jar; filesystem permission problems; classpath/resource (SERVICES_FILE) not found in the deployment layout.

Related errors


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