siyuan-note/siyuan · error · JsonRpcError

data.error.message

Error message

data.error.message

What it means

In KernelPluginClient #rpcCall, the kernel answered the JSON-RPC request but the response object carried an error; the thrown Error uses data.error.message from the remote side. The invoked plugin RPC method failed on the kernel (method not found, handler error, or argument error).

Solutions

  1. Read data.error.message to identify the failing RPC method
  2. Check that the RPC method was bound with matching name and signature
  3. Handle the rejection in the calling plugin code instead of leaving it uncaught
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at app/src/plugin/kernel.ts:205 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/3c589021d173bd76. Report an issue: GitHub.

Appendix: source

Thrown at app/src/plugin/kernel.ts:205

                return data;
            }
            await new Promise(resolve => window.setTimeout(resolve, KERNEL_PLUGIN_START_RETRY_INTERVAL));
        }
    }

    async #initState() {
        const response = await fetchSyncPost("/api/plugin/getLoadedPlugin", { name: this.#name });
        if (this.state.code === -1 && response.data?.stateCode != null) {
            this.state.code = response.data.stateCode;
        }
    }

    async #rpcCall(method: TJsonRpcMethod, ...params: TJsonRpcMethodParams): Promise<any> {
        const id = this.#generateId();

        const data = await this.#fetchRpc(JSON.stringify({ jsonrpc: "2.0", id, method, params }));
        if (data.error) {
            throw new JsonRpcError(data.error);
        }
        return data.result;
    }

    #rpcNotify(method: TJsonRpcMethod, ...params: TJsonRpcMethodParams): void {
        this.#fetchRpc(JSON.stringify({ jsonrpc: "2.0", method, params })).catch((error) => {
            console.error(`Failed to send JSON-RPC notification for method ${method}:`, error);
        });
    }

    async #rpcBatchCall(...calls: IKernelPluginRpcCall[]): Promise<IKernelPluginRpcError | (IKernelPluginRpcResultResponse | IKernelPluginRpcErrorResponse)[]> {
        const requests = calls.map(call => {
            const request: IKernelPluginRpcRequest = { jsonrpc: "2.0", method: call.method };
            if (call.params != null) {
                request.params = call.params;
            }
            if (!call.notification) {
                request.id = call.id ?? this.#generateId();

View on GitHub (pinned to 8641553a1f)