siyuan-note/siyuan · error · Error
window.siyuan.languages._kernel[28] (or server-provided data
Error message
window.siyuan.languages._kernel[28] (or server-provided data.msg/data.message)
What it means
Thrown by fetchAIEditorSSE when the POST to /api/ai/editor/chat either returns a non-2xx status or does not answer with Content-Type text/event-stream. The kernel rejected the AI chat request (auth, configuration, or server-side failure), so the SSE stream cannot be opened. The displayed text is the server-provided data.msg/data.message when the body is JSON, otherwise the localized kernel fallback at window.siyuan.languages._kernel[28].
Source
Thrown at app/src/ai/editorSSE.ts:110
onEvent: (event: TAIEditorSSEEvent) => void,
signal: AbortSignal,
) => {
const response = await fetch("/api/ai/editor/chat", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify(request),
signal,
});
const contentType = response.headers.get("Content-Type") || "";
if (!response.ok || !contentType.includes("text/event-stream")) {
let message = window.siyuan.languages._kernel[28];
try {
const data = await response.json();
message = data?.msg || data?.message || message;
} catch (e) {
// 响应不是 JSON 时使用统一错误文案。
}
throw new Error(message);
}
const reader = response.body?.getReader();
if (!reader) {
throw new Error(window.siyuan.languages._kernel[28]);
}
const decoder = new TextDecoder();
const parserState = createAIEditorSSEParserState();
let terminalReceived = false;
while (true) {
const result = await reader.read();
if (result.done) {
break;
}
parseAIEditorSSE(parserState, decoder.decode(result.value, {stream: true})).forEach(event => {
terminalReceived = terminalReceived || event.type === "done" || event.type === "error";
onEvent(event);
});
}View on GitHub (pinned to 8641553a1f)
Solutions
- Check that the AI provider is configured and the access token is valid in Settings - AI
- Verify the kernel is running and the endpoint /api/ai/editor/chat returns 200 with an event-stream content type
- Inspect the JSON body of the failed response; its msg or message field overrides the generic text
- Reproduce the request with curl to see the raw status code and body
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at app/src/ai/editorSSE.ts:110 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/571a3f7d071910c7.
Report an issue: GitHub.