{"record":{"id":"1bf4155234e6fae7","repo":"prestodb/presto","slug":"failed-to-build-plugin-classloaders-1bf415","errorCode":null,"errorMessage":"Failed to build plugin classloaders","messagePattern":"Failed to build plugin classloaders","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"presto-router/src/main/java/com/facebook/presto/router/RouterPluginManager.java","lineNumber":163,"sourceCode":"        {\n            pluginManager.installRouterPlugin(plugin);\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":145,"sourceCodeEnd":167,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-router/src/main/java/com/facebook/presto/router/RouterPluginManager.java#L145-L167","documentation":"RouterPluginManager.buildPluginClassLoaders wraps any exception raised while constructing plugin classloaders (locating plugin dirs, building the SPI/URL classloader) in a RuntimeException with message 'Failed to build plugin classloaders', preserving the cause.","triggerScenarios":"Plugin directory missing/unreadable, a malformed or duplicated SPI services file, or any Exception from the classloader construction for router SPI packages during plugin installation.","commonSituations":"Broken or incomplete plugin installation under plugin/router/; wrong file permissions after deployment; corrupt jar in the plugin directory; SERVICES_FILE resource missing from a plugin.","solutions":["Inspect the wrapped cause in the stack trace to find the failing jar or services file","Verify the plugin directory exists, is readable, and contains a well-formed META-INF/services entry","Reinstall/redeploy the plugin cleanly (remove partial installs and reinstall the plugin archive)"],"exampleFix":"// before: plugin/router/my-plugin/ missing META-INF/services/com.facebook.presto.spi.RouterPluginFactory\n// after: include the services file (or the plugin jar that provides it) in the plugin dir","handlingStrategy":"try-catch","validationCode":"Path pluginDir = Paths.get(\"plugin/router/my-plugin\");\nif (!Files.isDirectory(pluginDir) || !Files.isReadable(pluginDir)) {\n    throw new IllegalStateException(\"Plugin dir missing or unreadable: \" + pluginDir);\n}","typeGuard":null,"tryCatchPattern":"try { pluginManager.installRouterPlugin(plugin); } catch (RuntimeException e) {\n    if (\"Failed to build plugin classloaders\".equals(e.getMessage())) {\n        log.error(\"Plugin classloader failure; cause=\" + e.getCause());\n        // remove/repair the offending plugin directory before retry\n    } else throw e;\n}","preventionTips":["Verify plugin archive integrity (checksums) after deployment","Ensure each plugin ships META-INF/services entries for its SPI factory","Check filesystem permissions on plugin dirs post-deploy","Test plugin loading in a staging router before production rollout"],"tags":["presto","router","plugins","classloader"],"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"}