{"record":{"id":"dc76b79a8c651b8a","repo":"prestodb/presto","slug":"failed-to-build-plugin-classloaders","errorCode":null,"errorMessage":"Failed to build plugin classloaders","messagePattern":"Failed to build plugin classloaders","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"presto-flight-shim/src/main/java/com/facebook/presto/flightshim/FlightShimPluginManager.java","lineNumber":237,"sourceCode":"        {\n            return codecTransactionHandle;\n        }\n    }\n\n    private List<PluginManagerUtil.PluginClassLoaderHandle> createPluginClassLoaders()\n    {\n        try {\n            return PluginManagerUtil.buildClassLoaders(\n                    installedPluginsDir,\n                    plugins,\n                    resolver,\n                    SPI_PACKAGES,\n                    null,\n                    SERVICES_FILE,\n                    getClass().getClassLoader());\n        }\n        catch (Exception e) {\n            throw new RuntimeException(\"Failed to build plugin classloaders\", e);\n        }\n    }\n}\n","sourceCodeStart":219,"sourceCodeEnd":241,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-flight-shim/src/main/java/com/facebook/presto/flightshim/FlightShimPluginManager.java#L219-L241","documentation":"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.","triggerScenarios":"IOException/other exception while scanning plugin directories, reading services files, or creating URLClassLoader instances for SPI packages during createPluginClassLoaders.","commonSituations":"Missing or unreadable plugin directory; corrupt plugin jar; filesystem permission problems; classpath/resource (SERVICES_FILE) not found in the deployment layout.","solutions":["Inspect the cause stack trace to find the failing plugin directory/jar or missing resource","Fix file permissions and ensure the plugin directory layout is correct and jars are not corrupt","Verify the deployment includes all required plugin jars and services files for the shim"],"exampleFix":"// before (deployment)\nplugin.dir=/nonexistent/path\n// after\nplugin.dir=/opt/presto-server/plugin  (exists, readable, contains plugin jars)","handlingStrategy":"try-catch","validationCode":"// Pre-flight: ensure plugin dir exists and is readable before server start\nFile dir = new File(pluginDir);\nif (!dir.isDirectory() || !dir.canRead()) throw new IllegalStateException(\"Bad plugin dir: \" + pluginDir);","typeGuard":null,"tryCatchPattern":"try { server.start(); }\ncatch (RuntimeException e) {\n  if (\"Failed to build plugin classloaders\".equals(e.getMessage())) {\n    log.fatal(\"Plugin classloader failure\", e.getCause()); // inspect cause for IO/permission errors\n  }\n  throw e;\n}","preventionTips":["Verify plugin directory existence, permissions, and jar integrity in deployment scripts","Log and inspect the cause chain — the RuntimeException wraps the real IO error","Pin plugin jar checksums to detect corruption"],"tags":["classloader","plugin","startup","flight"],"backgroundTag":"classloader-init-failed","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"}