{"record":{"id":"18ab191b1081239c","repo":"quarkusio/quarkus","slug":"path-not-specified-18ab19","errorCode":null,"errorMessage":"Path not specified","messagePattern":"Path not specified","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/PathMatcher.java","lineNumber":87,"sourceCode":"\n        private T defaultHandler;\n        private final SubstringMap.Builder<T> pathsBuilder = new SubstringMap.Builder<>();\n\n        /**\n         * Adds a path prefix and a handler for that path. If the path does not start\n         * with a / then one will be prepended.\n         * <p>\n         * The match is done on a prefix bases, so registering /foo will also match /bar. Exact\n         * path matches are taken into account first.\n         * <p>\n         * If / is specified as the path then it will replace the default handler.\n         *\n         * @param path The path\n         * @param handler The handler\n         */\n        void addPrefixPath(final String path, final T handler) {\n            if (path.isEmpty()) {\n                throw new IllegalArgumentException(\"Path not specified\");\n            }\n\n            if (STRING_PATH_SEPARATOR.equals(path)) {\n                this.defaultHandler = handler;\n                return;\n            } else if (path.endsWith(STRING_PATH_SEPARATOR)) {\n                throw new RuntimeException(\"Prefix path cannot end with /\");\n            }\n\n            pathsBuilder.put(path, handler);\n        }\n\n        private int[] buildLengths(SubstringMap<T> paths) {\n            final Set<Integer> lengths = new TreeSet<>(new Comparator<>() {\n                @Override\n                public int compare(Integer o1, Integer o2) {\n                    return -o1.compareTo(o2);\n                }","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/PathMatcher.java#L69-L105","documentation":"PathMatcher.addPrefixPath throws this IllegalArgumentException when an empty string is passed as the path for a prefix route registration. The library requires a non-empty path; the root path must be expressed as \"/\" (which sets the defaultHandler), not \"\".","triggerScenarios":"Calling PathMatcher.addPrefixPath(\"\", handler) — e.g. programmatically registering a route or misconfigured @Path(\"\") mapping that resolves to an empty prefix during route building.","commonSituations":"Custom route registration code passing a blank path variable; annotation processing where @Path value is empty and not normalized to \"/\"; framework integrations that strip slashes incorrectly before registering prefixes.","solutions":["Use \"/\" instead of \"\" when registering the root prefix path","Normalize the path before calling addPrefixPath (e.g. path.isEmpty() ? \"/\" : path)","Check the @Path annotation value that produced the empty path and fix it to \"/\" or a valid sub-path"],"exampleFix":"// before\nmatcher.addPrefixPath(path, handler); // path == \"\"\n\n// after\nString normalized = path == null || path.isEmpty() ? \"/\" : path;\nmatcher.addPrefixPath(normalized, handler);","handlingStrategy":"validation","validationCode":"if (path == null || path.isEmpty()) {\n    throw new IllegalArgumentException(\"Prefix path must be non-empty; use \\\"/\\\" for the root\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    matcher.addPrefixPath(path, handler);\n} catch (IllegalArgumentException e) {\n    if (\"Path not specified\".equals(e.getMessage())) {\n        matcher.addPrefixPath(\"/\", handler); // fall back to root\n    } else throw e;\n}","preventionTips":["Normalize route paths at registration time (empty -> \"/\")","Never pass raw annotation values without normalization","Unit test custom route registration with empty-input cases"],"tags":["routing","path-matching","illegal-argument"],"backgroundTag":"empty-route-path","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"}