siyuan-note/siyuan · error · Error

version request returned HTTP " + response.status

Error message

version request returned HTTP " + response.status

What it means

requestRemoteKernelVersion fetches /api/system/version from a remote kernel target and throws when the HTTP response is not ok (non-2xx). This is the connectivity/health probe for connecting to a kernel hosted on another machine.

Source

Thrown at app/electron/main.js:2585

const fetchWithTimeout = async (url, options = {}, timeout = 5000) => {
    const abortController = new AbortController();
    const timer = setTimeout(() => abortController.abort(), timeout);
    try {
        return await session.defaultSession.fetch(url, Object.assign({
            credentials: "include",
            bypassCustomProtocolHandlers: true,
            redirect: "manual",
        }, options, {signal: abortController.signal}));
    } finally {
        clearTimeout(timer);
    }
};

const requestRemoteKernelVersion = async (target) => {
    const response = await fetchWithTimeout(target.origin + "/api/system/version", {method: "GET"});
    if (!response.ok) {
        await response.body?.cancel();
        throw new Error("version request returned HTTP " + response.status);
    }
    return response.json();
};

const isRemoteKernelAuthenticated = async (target) => {
    const response = await fetchWithTimeout(target.origin + "/stage/build/app/", {
        method: "GET",
        redirect: "manual",
    });
    if (response.status === 401 || response.status >= 300 && response.status < 400) {
        await response.body?.cancel();
        return false;
    }
    if (!response.ok) {
        await response.body?.cancel();
        throw new Error("authentication probe returned HTTP " + response.status);
    }
    await response.body?.cancel();

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Verify the remote kernel is running and reachable by opening target.origin in a browser
  2. Confirm the URL points to a SiYuan kernel root (the /api/system/version endpoint must exist)
  3. Check the HTTP status in the message: 401/403 means auth/proxy issues, 5xx means the remote server or proxy is unhealthy
  4. If behind a reverse proxy, ensure /api/* is forwarded unchanged to the kernel port

Example fix

// before
//   const url = "https://myserver:80/siyuan";
// after (point at the kernel origin root, correct port)
//   const url = "https://myserver:6806";
Defensive patterns

Strategy: try-catch

Validate before calling

if _, err := json.Marshal(Conf.NotebookCrypto); err != nil {
    // config struct not serializable; do not attempt backup save
}

Try / catch

if err := saveNotebookCryptoBackup(kek); err != nil {
    if strings.Contains(err.Error(), "marshal notebook crypto backup failed") {
        // inspect wrapped inner error; suspect struct/marshaler changes
    }
}

Prevention

When it happens

Trigger: fetchWithTimeout(target.origin + "/api/system/version", {method: "GET"}) resolves but response.ok is false — e.g. 404 because the URL is not a SiYuan kernel, 401/403 from auth, 502/503 from a reverse proxy, or 500 from a broken kernel.

Common situations: Typing a --remote URL that points at a non-SiYuan web server; remote kernel behind a proxy that rewrites paths; the remote kernel is down or restarting; firewall/WAF returning 403; wrong port in the URL.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11). Data as JSON: /api/errors/e008fc1d6154cb1e. Report an issue: GitHub.