{"record":{"id":"afcc2567b89f660f","repo":"quarkusio/quarkus","slug":"directory-bindingdirectory-does-not-repr","errorCode":null,"errorMessage":"Directory '\" + bindingDirectory + \"' does not represent a valid Service ServiceBinding directory as it does not specify a type","messagePattern":"Directory '\" \\+ bindingDirectory \\+ \"' does not represent a valid Service ServiceBinding directory as it does not specify a type","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/kubernetes-service-binding/runtime/src/main/java/io/quarkus/kubernetes/service/binding/runtime/ServiceBinding.java","lineNumber":54,"sourceCode":"    }\n\n    // visible for testing\n    ServiceBinding(String name, Map<String, String> filenameToContentMap, Path bindingDirectory) {\n        Map<String, String> properties = new HashMap<>();\n        String type = null;\n        String provider = null;\n        for (Map.Entry<String, String> entry : filenameToContentMap.entrySet()) {\n            if (TYPE.equals(entry.getKey())) {\n                type = entry.getValue();\n            } else if (PROVIDER.equals(entry.getKey())) {\n                provider = entry.getValue();\n            } else {\n                properties.put(entry.getKey(), entry.getValue());\n            }\n        }\n\n        if (type == null) {\n            throw new IllegalArgumentException(\"Directory '\" + bindingDirectory\n                    + \"' does not represent a valid Service ServiceBinding directory as it does not specify a type\");\n        }\n\n        this.bindingDirectory = bindingDirectory.toString();\n        this.name = name;\n        this.type = type;\n        this.provider = provider;\n        this.properties = Collections.unmodifiableMap(properties);\n    }\n\n    private static Map<String, String> getFilenameToContentMap(Path directory) {\n        if (!Files.exists(directory) || !Files.isDirectory(directory)) {\n            log.warn(\"File '\" + directory + \"' is not a proper service binding directory so it will skipped\");\n            return Collections.emptyMap();\n        }\n\n        File[] files = directory.toFile().listFiles(new FileFilter() {\n            @Override","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/kubernetes-service-binding/runtime/src/main/java/io/quarkus/kubernetes/service/binding/runtime/ServiceBinding.java#L36-L72","documentation":"The ServiceBinding constructor parses the files inside a binding directory and requires a 'type' entry identifying the kind of service (e.g. postgresql). If no type file/property is present it throws IllegalArgumentException, because a ServiceBinding without a type is invalid per the Service Binding spec and cannot be matched to a driver.","triggerScenarios":"A subdirectory under the Service Binding root exists but contains no 'type' file (or its properties lack a type key) — e.g. an empty directory, a directory with only 'provider'/'connection' files, or a binding dir created manually with only credentials.","commonSituations":"Hand-crafting a binding directory for local testing and forgetting the type file; a broken operator-generated binding; renaming/moving files so 'type' is missing; trailing-newline or naming issues making the file unreadable as a type.","solutions":["Add a file named 'type' in the binding directory containing the service type (e.g. 'postgresql').","Confirm the directory only contains regular files (not subdirectories) that the parser reads.","Re-create the binding via the Service Binding operator so all spec files are present.","Check for typos: the file must be exactly 'type' (lowercase)."],"exampleFix":"// before: bindings/my-db/ contains only 'password', 'username'\nmkdir bindings/my-db\nprintf 'postgresql' > bindings/my-db/type\nprintf 'myuser' > bindings/my-db/username\nprintf 'secret' > bindings/my-db/password","handlingStrategy":"validation","validationCode":"static void validateBindingDir(Path dir) throws IOException {\n    try (var s = Files.list(dir)) {\n        boolean hasType = s.map(p -> p.getFileName().toString())\n                           .anyMatch(\"type\"::equals);\n        if (!hasType) throw new IllegalStateException(\"Binding dir \" + dir + \" has no 'type' file\");\n    }\n}","typeGuard":"static boolean hasBindingType(Path dir) {\n    return Files.isRegularFile(dir.resolve(\"type\"));\n}","tryCatchPattern":"try {\n    new ServiceBinding(dir, bindingsRoot);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"does not specify a type\")) {\n        log.warn(\"Binding dir {} needs a 'type' file\", dir);\n    }\n}","preventionTips":["Always create the 'type' file first when hand-crafting binding directories.","Let the Service Binding operator generate bindings instead of manual files.","Lint binding dirs in CI: every subdirectory must contain a lowercase 'type' file.","Keep provider files separate from type — 'provider' does not substitute for 'type'."],"tags":["service-binding","missing-file","configuration","service-binding-spec"],"backgroundTag":"missing-type-file","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}