{"record":{"id":"5929647e1537dfd5","repo":"quarkusio/quarkus","slug":"service-interface-descriptor-file-path-cannot-be-n","errorCode":null,"errorMessage":"service interface descriptor file path cannot be null","messagePattern":"service interface descriptor file path cannot be null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/ServiceProviderBuildItem.java","lineNumber":49,"sourceCode":"    private final List<String> providers;\n\n    /**\n     * Creates and returns a {@link ServiceProviderBuildItem} for the {@code serviceInterfaceClassName} by including\n     * all the providers that are listed in the service interface descriptor file.\n     *\n     * @param serviceInterfaceClassName the interface whose service interface descriptor file we want to embed\n     * @param serviceInterfaceDescriptorFile the path to the service interface descriptor file\n     * @return\n     * @throws IOException\n     */\n    public static ServiceProviderBuildItem allProviders(final String serviceInterfaceClassName,\n            final Path serviceInterfaceDescriptorFile)\n            throws IOException {\n        if (serviceInterfaceClassName == null || serviceInterfaceClassName.trim().isEmpty()) {\n            throw new IllegalArgumentException(\"service interface name cannot be null or blank\");\n        }\n        if (serviceInterfaceDescriptorFile == null) {\n            throw new IllegalArgumentException(\"service interface descriptor file path cannot be null\");\n        }\n        final Set<String> classNames = new LinkedHashSet<>();\n        final List<String> lines = Files.readAllLines(serviceInterfaceDescriptorFile, StandardCharsets.UTF_8);\n        // parse each line and add each listed provider\n        for (String line : lines) {\n            final int commentIndex = line.indexOf('#');\n            if (commentIndex >= 0) {\n                // strip off anything after the # (including the #)\n                line = line.substring(0, commentIndex);\n            }\n            line = line.trim();\n            if (!line.isEmpty()) {\n                classNames.add(line);\n            }\n        }\n        return new ServiceProviderBuildItem(serviceInterfaceClassName, List.copyOf(classNames), false);\n    }\n","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/ServiceProviderBuildItem.java#L31-L67","documentation":"The same allProviders() factory validates that the service interface descriptor file Path is non-null, since it must read META-INF/services/<interface> lines from it. A null path is an immediate IllegalArgumentException before any I/O.","triggerScenarios":"Calling ServiceProviderBuildItem.allProviders(iface, null), typically when the resource lookup that should produce the Path returned null.","commonSituations":"Trying to locate the descriptor via ClassLoader.getResource which returned null (resource not on the build classpath) and forwarding null; a build-step config option left unset.","solutions":["Ensure the descriptor file exists on the build classpath and pass its real Path","Or use allProvidersFromClassPath(serviceInterfaceClassName) which resolves the resource itself","Guard the path with Objects.requireNonNull before calling"],"exampleFix":"// before\nServiceProviderBuildItem.allProviders(\"com.example.MySpi\", path); // path may be null\n// after\nif (path == null) throw new IllegalStateException(\"descriptor missing on classpath\");\nServiceProviderBuildItem.allProviders(\"com.example.MySpi\", path);","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(descriptorPath, \"descriptor path required\");\nif (!Files.exists(descriptorPath)) throw new IllegalStateException(\"descriptor missing: \" + descriptorPath);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check ClassLoader.getResource(...) results for null before converting to a Path","Prefer allProvidersFromClassPath when the descriptor is a classpath resource","Verify the provider JAR is a build dependency"],"tags":["native-image","spi","null-pointer"],"backgroundTag":"invalid-argument-null-or-blank","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}