Wei-Shaw/sub2api · error
admin.accounts.grok.noResponseBody
Error message
admin.accounts.grok.noResponseBody
What it means
In frontend/src/components/admin/account/AccountTestModal.vue:901, after response.ok passes, response.body?.getReader() returns undefined when response.body is null, throwing the localized 'admin.accounts.grok.noResponseBody' message. null body occurs when the response genuinely has no payload (204/304, closed stream) or when the browser/proxy environment does not expose fetch streaming.
Source
Thrown at frontend/src/components/admin/account/AccountTestModal.vue:901
// Use fetch with streaming for SSE since EventSource doesn't support POST
const response = await fetch(url, {
method: 'POST',
headers: {
Authorization: `Bearer ${localStorage.getItem('auth_token')}`,
'Content-Type': 'application/json',
[ADMIN_UI_REQUEST_HEADER]: '1'
},
body: JSON.stringify(requestBody),
signal: abortController.signal
})
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const reader = response.body?.getReader()
if (!reader) {
throw new Error(t('admin.accounts.grok.noResponseBody'))
}
const decoder = new TextDecoder()
let buffer = ''
while (true) {
const { done, value } = await reader.read()
if (done) break
buffer += decoder.decode(value, { stream: true })
const lines = buffer.split('\n')
buffer = lines.pop() || ''
for (const line of lines) {
if (line.startsWith('data: ')) {
const jsonStr = line.slice(6).trim()
if (jsonStr) {
try {View on GitHub (pinned to 073e92d171)
Solutions
- Test the endpoint with curl -N to confirm chunked streaming reaches the client.
- Set proxy_buffering off / X-Accel-Buffering: no on the admin test route.
- Fall back to response.text() when body is missing so non-streamed payloads still render.
- Log Content-Type/Content-Length of the failing response to distinguish empty-body from no-stream-support.
Example fix
// before
const reader = response.body?.getReader()
if (!reader) {
throw new Error(t('admin.accounts.grok.noResponseBody'))
}
// after
const reader = response.body?.getReader()
if (!reader) {
const text = await response.text().catch(() => '')
if (text) { processNonStreamed(text); return }
throw new Error(t('admin.accounts.grok.noResponseBody'))
} Defensive patterns
Strategy: fallback
Validate before calling
if (typeof ReadableStream === 'undefined') { showUnsupportedNotice(); } Try / catch
try { await runAdminStream(); }
catch (e) {
if (e.message === t('admin.accounts.grok.noResponseBody')) {
await retryOnceWithNoBuffering(); // or fall back to non-stream endpoint
return;
}
throw e;
} Prevention
- Ensure the admin streaming route disables proxy buffering
- Fall back to response.text() when getReader() is unavailable
- Log response headers of failures to distinguish empty body from no stream support
When it happens
Trigger: Admin test endpoint returns an empty or non-streamed response; nginx/CDN buffering collapses the chunked stream into nothing; old WebView without ReadableStream support; server handler returns early with no body on a success status.
Common situations: Admin UI behind Cloudflare or an nginx default config that buffers; empty 200 responses from upstream when the model returns nothing; embedded-browser admin panels.
Related errors
- No response body
- HTTP error! status: ${response.status}
- HTTP error! status: ${response.status}
- admin.backup.actions.downloadFailed
- auth.oidc.callbackMissingToken
AI-assisted analysis of Wei-Shaw/sub2api@073e92d171 (2026-08-15).
Data as JSON: /api/errors/98757503db4e9692.
Report an issue: GitHub.