halo-dev/halo · error · ServerWebInputException
The name must not be null.
Error message
The name must not be null.
What it means
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.
Source
Thrown at application/src/main/java/run/halo/app/core/endpoint/theme/CommentFinderEndpoint.java:280
@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;
}
/** Whether to include replies. Defaults to false. */
@Schema(defaultValue = "false")
public Boolean getWithReplies() {
var withReplies = queryParams.getFirst("withReplies");
return StringUtils.isNotBlank(withReplies) && Boolean.parseBoolean(withReplies);
}
/** Reply size of the comment. Defaults to 10 and only works when withReplies is true. */
@Schema(defaultValue = "10")
public int getReplySize() {
var replySize = queryParams.getFirst("replySize");
return StringUtils.isNotBlank(replySize) ? Integer.parseInt(replySize) : 10;
}
View on GitHub (pinned to d2f5165f9c)
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.
Example fix
// before: GET /apis/.../comments?kind=SinglePage // after: GET /apis/.../comments?kind=SinglePage&name=my-page
Defensive patterns
Strategy: validation
Validate before calling
// require non-empty name before listing comments
if (StringUtils.isBlank(name)) {
showUserError("Subject name is required");
return;
}
url += "?kind=" + kind + "&name=" + name; Prevention
- 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.
When it happens
Trigger: GET on the theme comment listing endpoint with a 'kind' but missing/empty 'name' query parameter. emptyToNull returns null and the guard throws.
Common situations: Theme links omit the subject name; URL builder bug; page with no name resolved; test fixture sent only kind.
Related errors
- The kind 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/bd958d4594ef3ee9.
Report an issue: GitHub.