siyuan-note/siyuan · error
panic during siyuan.client.fetch: %v
Error message
panic during siyuan.client.fetch: %v
What it means
A panic was recovered inside the background goroutine that performs the HTTP request for siyuan.client.fetch. The %v is the recovered panic value. This is an internal failure (nil pointer, slice out of range, etc.) in the request path, not a caller argument error — argument errors are caught earlier and reject with their own message.
Source
Thrown at kernel/plugin/api_client.go:106
}
}
}
}
}
}
}
runErr := p.worker.Run(func(rt *goja.Runtime) (_ any, err error) {
if argErr != nil {
err = argErr
return
}
go func() {
var err error
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("panic during siyuan.client.fetch: %v", r)
}
if err != nil {
p.worker.Run(func(rt *goja.Runtime) (_ any, _ error) {
if rejectErr := reject(rt.NewGoError(err)); rejectErr != nil {
logging.LogErrorf("[plugin:%s] siyuan.client.fetch reject: %v", p.Name, rejectErr)
}
return
}, nil)
}
}()
targetURL := fmt.Sprintf("http://127.0.0.1:%s%s", util.ServerPort, path)
r := httpClient.R()
for k, v := range headers {
r.SetHeader(k, v)
}
r.SetHeader(model.XAuthTokenKey, p.token)View on GitHub (pinned to 251596fc0d)
Solutions
- Check the kernel log for the panic stack (the message includes the recovered value) and report it with the plugin name.
- Ensure the plugin is not being unloaded/reloaded while requests are in flight.
- Update to the latest kernel/plugin version — panics are usually fixed bugs.
Example fix
try {
await siyuan.client.fetch('/api/x');
} catch (e) {
// internal panic, not an argument error — log and degrade
console.error('fetch panic', e);
} Defensive patterns
Strategy: try-catch
Try / catch
try {
const res = await siyuan.client.fetch('/api/x');
} catch (e) {
if (String(e).startsWith('panic during')) {
// internal runtime failure — log; optionally retry once
} else {
// argument or network error — handle by message
}
} Prevention
- Always await fetch inside try/catch in plugins.
- Avoid unloading/reloading a plugin while it has pending requests.
- Keep kernel and plugin runtime versions in sync.
When it happens
Trigger: A bug in the kernel plugin runtime or a dependency panicking during request construction, send, or response assembly; or the plugin being unloaded (context cancelled) mid-request racing with response building.
Common situations: Kernel/plugin version mismatch, plugin hot-reload while a fetch is in flight, or an unhandled nil from httpClient.R(). Rare in normal use.
Related errors
- panic during siyuan.client.event: %v
- attribute view [%s] changed while loading search info
- encrypted notebook is locked, please unlock it first
- panic: gulu.Zip.Unzip error (dynamic message from err)
- OAuth callback was already handled
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/70efe2d878e8fc41.
Report an issue: GitHub.