siyuan-note/siyuan · error
invalid agent runtime revision
Error message
invalid agent runtime revision
What it means
Rejected by siyuan.rpc.broadcast(method, params) when called with no arguments (kernel/plugin/api_rpc.go:147). Broadcasting invokes a bound RPC method on all connected clients, and the method name is mandatory; params are optional and may be omitted, but the name may not.
Source
Thrown at kernel/agent/runtime.go:210
data, err := os.ReadFile(runtimePath(sessionID))
if err != nil {
if os.IsNotExist(err) {
return &agentRuntime{SchemaVersion: 1, SessionID: sessionID}, nil
}
return nil, err
}
var runtime agentRuntime
if err := gulu.JSON.UnmarshalJSON(data, &runtime); err != nil {
return nil, err
}
if runtime.SchemaVersion > 1 {
return nil, fmt.Errorf("unsupported agent runtime schema version: %d", runtime.SchemaVersion)
}
if runtime.SessionID != "" && runtime.SessionID != sessionID {
return nil, fmt.Errorf("agent runtime session id mismatch")
}
if runtime.Revision < 0 {
return nil, fmt.Errorf("invalid agent runtime revision")
}
if runtime.ActiveTurn != nil {
if runtime.ActiveTurn.TurnID == "" {
return nil, fmt.Errorf("invalid agent runtime turn id")
}
switch runtime.ActiveTurn.State {
case "running", "finished", "interrupted":
default:
return nil, fmt.Errorf("invalid agent runtime turn state")
}
}
if runtime.SchemaVersion == 0 {
runtime.SchemaVersion = 1
}
if runtime.SessionID == "" {
runtime.SessionID = sessionID
}
return &runtime, nilView on GitHub (pinned to afa823b6b4)
Solutions
- Always pass the method string first: siyuan.rpc.broadcast('myplugin.notify', payload)
- Default the method from a constant so it can never be omitted
- Guard spreads: if (args.length >= 1 && typeof args[0] === 'string')
Example fix
// before
siyuan.rpc.broadcast(payload); // name missing
// after
siyuan.rpc.broadcast('myplugin.notify', payload); Defensive patterns
Strategy: type-guard
Validate before calling
if (typeof method === 'string' && method.length > 0) siyuan.rpc.broadcast(method, params);
Type guard
const isRpcName = (v) => typeof v === 'string' && v.length > 0;
Try / catch
try { siyuan.rpc.broadcast(method, params); } catch (e) { if (/method required/.test(e.message)) throw new TypeError('broadcast called without a method name'); else throw e; } Prevention
- Always call broadcast(methodName, params) — name first
- Default to a constant notification method in shared helpers
- Guard spread-based calls for arity
When it happens
Trigger: siyuan.rpc.broadcast() with the method forgotten; broadcast(params) passing only the payload; spread calls broadcast(...args) with an empty args array.
Common situations: Fire-and-forget notification code where the method constant was inlined elsewhere; refactors moving params construction earlier and dropping the name; optional-chained config giving undefined for the method.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- agent runtime session id mismatch
- invalid agent runtime turn id
- agent runtime user entry not found
- first argument must be a tool name string
- second argument must be a config object
AI-assisted analysis of siyuan-note/siyuan@afa823b6b4 (2026-08-18).
Data as JSON: /api/errors/8d8909136b3e3b7d.
Report an issue: GitHub.