{"record":{"id":"8a17bc3e8a6eb25d","repo":"halo-dev/halo","slug":"the-kind-must-not-be-null","errorCode":null,"errorMessage":"The kind must not be null.","messagePattern":"The kind 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":266,"sourceCode":"            return queryParams.getFirst(\"group\");\n        }\n\n        /** The comment subject version. */\n        @Schema(requiredMode = REQUIRED)\n        public String getVersion() {\n            return emptyToNull(queryParams.getFirst(\"version\"));\n        }\n\n        /**\n         * Gets the {@link Ref}s kind.\n         *\n         * @return comment subject ref kind\n         */\n        @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","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/halo-dev/halo/blob/d2f5165f9c8f055ffcb3fa9c3f4032821a7b68c8/application/src/main/java/run/halo/app/core/endpoint/theme/CommentFinderEndpoint.java#L248-L284","documentation":"Thrown as a ServerWebInputException (HTTP 400) by CommentFinderEndpoint's ListRequest.getKind() when the 'kind' query parameter is absent or empty. 'kind' identifies the subject Ref kind (e.g. SinglePage, Post) the comment refers to and is required for listing.","triggerScenarios":"GET on the theme comment listing endpoint without a 'kind' query parameter, or with kind= (empty). emptyToNull returns null and the guard throws.","commonSituations":"Frontend builds the comment URL without the kind; refactor dropped the param; test request omitted it; theme hard-coded only the name.","solutions":["Include a non-empty 'kind' query parameter, e.g. ?kind=SinglePage&name=... on the comment listing request.","Ensure the theme constructs comment links with both kind and name of the subject resource.","Add a client-side check that aborts the request when kind is missing."],"exampleFix":"// before: GET /apis/.../comments?name=about\n// after:  GET /apis/.../comments?kind=SinglePage&name=about","handlingStrategy":"validation","validationCode":"// require non-empty kind before listing comments\nif (StringUtils.isBlank(kind)) {\n    showUserError(\"Subject kind is required\");\n    return;\n}\nurl += \"?kind=\" + kind + \"&name=\" + name;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always build comment URLs with both kind and name of the subject.","Abort the request client-side if kind is missing."],"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"}