halo-dev/halo · warning · Error
json.detail
Error message
json.detail
What it means
Client-side JS in the complete-profile flow: when /complete-profile/send-email-code returns a non-ok response whose body has no errors array but does have a `detail` field (RFC 7807 ProblemDetail shape), sendRequest() throws new Error(json.detail). The Error message is the server-provided detail string. This branch is reached only when json.errors is absent/empty and json.detail is truthy.
Source
Thrown at application/src/main/resources/templates/gateway_fragments/complete_profile.html:90
async function sendRequest() {
const email = document.getElementById("email").value;
const response = await fetch("/complete-profile/send-email-code", {
method: "POST",
body: JSON.stringify({ email: email }),
headers: {
"Content-Type": "application/json",
[headerName]: token,
},
});
if (!response.ok) {
const json = await response.json();
if (json.errors && json.errors.length) {
throw new Error(json.errors[0]);
}
if (json.detail) {
throw new Error(json.detail);
}
throw new Error(i18nResources.sendVerificationCodeFailed);
}
return response;
}
const emailCodeSendButton = document.getElementById("emailCodeSendButton");
sendVerificationCode(emailCodeSendButton, sendRequest);
});
</script>
</form>
View on GitHub (pinned to d2f5165f9c)
Solutions
- Read the detail string shown to the user; it is the server's explanation.
- Retry after addressing the stated reason or once the transient condition clears.
- Refresh the page for a new CSRF token if the detail suggests auth/CSRF.
- Check server logs if the detail indicates an internal error (5xx).
Defensive patterns
Strategy: try-catch
Validate before calling
// Validate inputs and freshness before the request (same as 136):
if (!email || !/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email)) {
showError("Enter a valid email."); return;
} Type guard
function hasProblemDetail(json) {
return json != null && typeof json.detail === "string" && json.detail.length > 0;
} Try / catch
try {
await sendRequest();
} catch (e) {
// e.message === server's ProblemDetail.detail
showToast(e.message || i18nResources.sendVerificationCodeFailed);
} Prevention
- Read the detail string — it is the server's explanation.
- Refresh the page for a new CSRF token if the detail suggests auth/CSRF.
- Retry after the stated reason is addressed.
- Check server logs for 5xx ProblemDetails indicating internal errors.
When it happens
Trigger: The email-code endpoint returns a ProblemDetail response (e.g. 400/409/500) with a `detail` field and no `errors` array — such as a generic server error, a conflict, or a handled exception surfaced as a problem detail.
Common situations: Backend throws a mapped exception that serializes to ProblemDetail; rate-limit/throttle response with detail; transient server error.
Related errors
AI-assisted analysis of halo-dev/halo@d2f5165f9c (2026-08-14).
Data as JSON: /api/errors/4ca9ac8fd65e7367.
Report an issue: GitHub.