{"record":{"id":"bd958d4594ef3ee9","repo":"halo-dev/halo","slug":"the-name-must-not-be-null","errorCode":null,"errorMessage":"The name must not be null.","messagePattern":"The name must not be null\\.","errorType":"validation","errorClass":"ServerWebInputException","httpStatus":400,"severity":"error","filePath":"application/src/main/java/run/halo/app/core/endpoint/theme/CommentFinderEndpoint.java","lineNumber":280,"sourceCode":"        @Schema(requiredMode = REQUIRED)\n        public String getKind() {\n            String kind = emptyToNull(queryParams.getFirst(\"kind\"));\n            if (kind == null) {\n                throw new ServerWebInputException(\"The kind must not be null.\");\n            }\n            return kind;\n        }\n\n        /**\n         * Gets the {@link Ref}s name.\n         *\n         * @return comment subject ref name\n         */\n        @Schema(requiredMode = REQUIRED)\n        public String getName() {\n            String name = emptyToNull(queryParams.getFirst(\"name\"));\n            if (name == null) {\n                throw new ServerWebInputException(\"The name must not be null.\");\n            }\n            return name;\n        }\n\n        /** Whether to include replies. Defaults to false. */\n        @Schema(defaultValue = \"false\")\n        public Boolean getWithReplies() {\n            var withReplies = queryParams.getFirst(\"withReplies\");\n            return StringUtils.isNotBlank(withReplies) && Boolean.parseBoolean(withReplies);\n        }\n\n        /** Reply size of the comment. Defaults to 10 and only works when withReplies is true. */\n        @Schema(defaultValue = \"10\")\n        public int getReplySize() {\n            var replySize = queryParams.getFirst(\"replySize\");\n            return StringUtils.isNotBlank(replySize) ? Integer.parseInt(replySize) : 10;\n        }\n","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/halo-dev/halo/blob/d2f5165f9c8f055ffcb3fa9c3f4032821a7b68c8/application/src/main/java/run/halo/app/core/endpoint/theme/CommentFinderEndpoint.java#L262-L298","documentation":"Thrown as a ServerWebInputException (HTTP 400) by CommentFinderEndpoint's ListRequest.getName() when the 'name' query parameter is absent or empty. 'name' is the subject Ref's metadata.name and is required alongside 'kind' to locate the comment's target.","triggerScenarios":"GET on the theme comment listing endpoint with a 'kind' but missing/empty 'name' query parameter. emptyToNull returns null and the guard throws.","commonSituations":"Theme links omit the subject name; URL builder bug; page with no name resolved; test fixture sent only kind.","solutions":["Include a non-empty 'name' query parameter together with 'kind', e.g. ?kind=SinglePage&name=my-page.","Ensure the theme resolves and appends the subject resource's metadata.name to the comment URL.","Client-side validate that both kind and name are present before issuing the request."],"exampleFix":"// before: GET /apis/.../comments?kind=SinglePage\n// after:  GET /apis/.../comments?kind=SinglePage&name=my-page","handlingStrategy":"validation","validationCode":"// require non-empty name before listing comments\nif (StringUtils.isBlank(name)) {\n    showUserError(\"Subject name is required\");\n    return;\n}\nurl += \"?kind=\" + kind + \"&name=\" + name;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Resolve the subject resource's metadata.name and include it in the comment URL.","Validate both kind and name client-side before issuing the request."],"tags":["comment","validation","required-field","query-param","webflux"],"backgroundTag":null,"analyzedSha":"d2f5165f9c8f055ffcb3fa9c3f4032821a7b68c8","analyzedAt":"2026-08-14T00:18:38.915Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}