{"record":{"id":"2ac0ab71d6c21706","repo":"neo4j/neo4j","slug":"s-is-not-a-valid-name","errorCode":null,"errorMessage":"'%s' is not a valid name","messagePattern":"'(.+?)' is not a valid name","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"community/capabilities/src/main/java/org/neo4j/capabilities/Name.java","lineNumber":66,"sourceCode":"    /**\n     * Returns the full name.\n     *\n     * @return full name.\n     */\n    public String fullName() {\n        return fullName;\n    }\n\n    /**\n     * Creates a child name from this name instance.\n     *\n     * @param name child name.\n     * @return new name instance.\n     * @throws IllegalArgumentException if name is empty or contains '.'.\n     */\n    public Name child(String name) {\n        if (isBlank(name) || contains(name, SEPARATOR)) {\n            throw new IllegalArgumentException(String.format(\"'%s' is not a valid name\", name));\n        }\n\n        if (isBlank(this.fullName)) {\n            return new Name(name);\n        }\n\n        return new Name(this.fullName + SEPARATOR + Objects.requireNonNull(name));\n    }\n\n    /**\n     * Checks if this name instance is in the given namespace.\n     *\n     * @param namespace namespace to check\n     * @return true if this name lies in the given namespace, false otherwise.\n     */\n    public boolean isIn(String namespace) {\n        var validated = validateName(namespace);\n","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/neo4j/neo4j/blob/f213380f812b820a1b312e2ea52cb3d8f1931ccc/community/capabilities/src/main/java/org/neo4j/capabilities/Name.java#L48-L84","documentation":"Thrown by Name.child(String) in the capabilities API when the proposed child component is blank or contains the '.' namespace separator. Capability names are hierarchical dot-separated paths (e.g. 'db.query.execution'); child() accepts a single segment only, so an empty/whitespace string or a dotted multi-segment argument is rejected with IllegalArgumentException.","triggerScenarios":"Calling capabilityName.child(\"\") , child(\"   \"), or child(\"a.b\") — e.g. building a capability tree programmatically from user input or config keys that arrive fully qualified instead of as segments.","commonSituations":"Constructing capability names from configuration keys that already contain dots; Splitting logic that yields empty segments (trailing dots, double dots) fed straight into child(); Refactors moving from full-name strings to the child() builder without stripping separators","solutions":["Split fully-qualified names on '.' and chain child() per segment, or use Name.of(fullName) which accepts dotted names","Sanitize segments: trim and reject empty parts before calling child()","Validate user-supplied names against ^\\w+$ before building children"],"exampleFix":"// before\nName parent = Name.of(\"db\");\nName n = parent.child(\"query.execution\");\n\n// after\nName n = Name.of(\"db.query.execution\");","handlingStrategy":"validation","validationCode":"String segment = name.trim();\nif (segment.isEmpty() || segment.contains(\".\")) throw new IllegalArgumentException(\"bad segment\");\nName child = parent.child(segment);","typeGuard":"private static boolean isValidSegment(String s) { return s != null && !s.isBlank() && !s.contains(\".\") && s.matches(\"\\\\w+\"); }","tryCatchPattern":"catch (IllegalArgumentException e) { if (e.getMessage().contains(\"not a valid name\")) { split on '.' and chain child() per segment; } else throw e; }","preventionTips":["Use Name.of(fullDottedName) for pre-qualified strings, child() for single segments only","Validate external inputs against ^\\w+$ before building capability trees"],"tags":["capabilities","validation","naming","illegal-argument"],"backgroundTag":null,"analyzedSha":"f213380f812b820a1b312e2ea52cb3d8f1931ccc","analyzedAt":"2026-08-14T15:32:33.859Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}