{"record":{"id":"34499cf72c6ac309","repo":"quarkusio/quarkus","slug":"service-binding-root-p-is-not-a-director","errorCode":null,"errorMessage":"Service Binding root '\" + p + \"' is not a directory","messagePattern":"Service Binding root '\" \\+ p \\+ \"' is not a directory","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/kubernetes-service-binding/runtime/src/main/java/io/quarkus/kubernetes/service/binding/runtime/KubernetesServiceBindingConfigSourceFactory.java","lineNumber":88,"sourceCode":"            Map<String, String> rawConfigSourceProperties = new HashMap<>();\n            for (Map.Entry<String, String> entry : serviceBindingProperties.entrySet()) {\n                rawConfigSourceProperties.put(\"quarkus.service-binding.\" + serviceBinding.getName() + \".\" + entry.getKey(),\n                        entry.getValue());\n            }\n            result.add(new ServiceBindingConfigSource(\"service-binding-\" + serviceBinding.getName() + \"-raw\",\n                    rawConfigSourceProperties));\n        }\n        return result;\n    }\n\n    static List<ServiceBinding> getServiceBindings(String bindingRoot) {\n        Path p = Paths.get(bindingRoot);\n        if (!Files.exists(p)) {\n            log.warn(\"Service Binding root '\" + p.toAbsolutePath() + \"' does not exist\");\n            return emptyList();\n        }\n        if (!Files.isDirectory(p)) {\n            throw new IllegalArgumentException(\"Service Binding root '\" + p + \"' is not a directory\");\n        }\n\n        File[] files = p.toFile().listFiles();\n        if (files == null) {\n            log.warn(\"Service Binding root '\" + p.toAbsolutePath() + \"' does not contain any sub-directories\");\n            return emptyList();\n        } else {\n            log.debug(\"Found \" + files.length + \" potential Service Binding directories\");\n            List<ServiceBinding> serviceBindings = new ArrayList<>(files.length);\n            for (File f : files) {\n                ServiceBinding sb = new ServiceBinding(f.toPath());\n                serviceBindings.add(sb);\n                if (log.isDebugEnabled()) {\n                    log.debug(String.format(\"Directory '%s' contains %d %s and will be used as Service Binding %s\",\n                            f.toPath().toAbsolutePath(), sb.getProperties().size(),\n                            sb.getProperties().size() == 1 ? \"property\" : \"properties\", sb));\n                }\n            }","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/kubernetes-service-binding/runtime/src/main/java/io/quarkus/kubernetes/service/binding/runtime/KubernetesServiceBindingConfigSourceFactory.java#L70-L106","documentation":"KubernetesServiceBindingConfigSourceFactory.getServiceBindings validates that the Service Binding root path (typically /k8s/service-binding or a path in bindings config) is a directory and throws IllegalArgumentException if the path exists but is not a directory. This is a configuration/paths validation guard: a file was placed where a directory of service binding directories is expected.","triggerScenarios":"SERVICE_BINDING_ROOT (or quarkus.kubernetes-service-binding.root) points at an existing regular file or symlink-to-file instead of a directory containing per-binding subdirectories.","commonSituations":"Mount mistake in Kubernetes (mounting a file over the binding root path); misconfigured SERVICE_BINDING_ROOT env var in dev/test; testing with a stub file instead of a directory tree.","solutions":["Ensure SERVICE_BINDING_ROOT points to a directory containing one subdirectory per binding.","Fix the volume mount so a directory (not a file) is mounted at the binding root.","Correct the path value if SERVICE_BINDING_ROOT was set by hand in your environment.","If the path doesn't exist at all the factory just warns — check the warning: a wrong path that resolves to a file means a stale or wrong mount."],"exampleFix":"// before (env): SERVICE_BINDING_ROOT=/etc/bindings/bindings.json\n// after: point to a directory of binding dirs\nexport SERVICE_BINDING_ROOT=/etc/bindings\nmkdir -p /etc/bindings/my-db\necho postgres > /etc/bindings/my-db/type","handlingStrategy":"validation","validationCode":"Path root = Paths.get(System.getenv().getOrDefault(\"SERVICE_BINDING_ROOT\", \"/k8s/service-binding\"));\nif (Files.exists(root) && !Files.isDirectory(root)) {\n    throw new IllegalStateException(\"SERVICE_BINDING_ROOT must be a directory: \" + root);\n}","typeGuard":"static boolean isValidBindingRoot(String p) {\n    Path root = Paths.get(p);\n    return Files.exists(root) && Files.isDirectory(root);\n}","tryCatchPattern":"try {\n    loadServiceBindings();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"is not a directory\")) {\n        log.warn(\"Fix SERVICE_BINDING_ROOT: {}\", e.getMessage());\n    }\n}","preventionTips":["Mount a directory (volume), never a single file, at the binding root path.","Echo $SERVICE_BINDING_ROOT in startup logs to catch misconfiguration early.","In tests, create the binding tree with Files.createTempDirectory.","Validate the mount shape in CI with a pre-start script: [ -d \"$SERVICE_BINDING_ROOT\" ]."],"tags":["service-binding","filesystem","configuration","path"],"backgroundTag":"invalid-path-configured","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}