halo-dev/halo · error · ServerWebInputException
The kind must not be null.
Error message
The kind must not be null.
What it means
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.
Source
Thrown at application/src/main/java/run/halo/app/core/endpoint/theme/CommentFinderEndpoint.java:266
return queryParams.getFirst("group");
}
/** The comment subject version. */
@Schema(requiredMode = REQUIRED)
public String getVersion() {
return emptyToNull(queryParams.getFirst("version"));
}
/**
* Gets the {@link Ref}s kind.
*
* @return comment subject ref kind
*/
@Schema(requiredMode = REQUIRED)
public String getKind() {
String kind = emptyToNull(queryParams.getFirst("kind"));
if (kind == null) {
throw new ServerWebInputException("The kind must not be null.");
}
return kind;
}
/**
* Gets the {@link Ref}s name.
*
* @return comment subject ref name
*/
@Schema(requiredMode = REQUIRED)
public String getName() {
String name = emptyToNull(queryParams.getFirst("name"));
if (name == null) {
throw new ServerWebInputException("The name must not be null.");
}
return name;
}
View on GitHub (pinned to d2f5165f9c)
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.
Example fix
// before: GET /apis/.../comments?name=about // after: GET /apis/.../comments?kind=SinglePage&name=about
Defensive patterns
Strategy: validation
Validate before calling
// require non-empty kind before listing comments
if (StringUtils.isBlank(kind)) {
showUserError("Subject kind is required");
return;
}
url += "?kind=" + kind + "&name=" + name; Prevention
- Always build comment URLs with both kind and name of the subject.
- Abort the request client-side if kind is missing.
When it happens
Trigger: GET on the theme comment listing endpoint without a 'kind' query parameter, or with kind= (empty). emptyToNull returns null and the guard throws.
Common situations: Frontend builds the comment URL without the kind; refactor dropped the param; test request omitted it; theme hard-coded only the name.
Related errors
- The name must not be null.
- The required parameter 'commentName' is missing.
- Name is required
- Email is required
- Only support 'email' owner kind.
AI-assisted analysis of halo-dev/halo@d2f5165f9c (2026-08-14).
Data as JSON: /api/errors/8a17bc3e8a6eb25d.
Report an issue: GitHub.