siyuan-note/siyuan · critical
goja panic during event loop run: %v
Error message
goja panic during event loop run: %v
What it means
During plugin startup, `InitRuntime` runs a setup function inside the plugin's goja event loop. A Go-level panic raised anywhere in that setup (field-name mapper installation, module registration, etc.) is recovered and reported as `goja panic during event loop run: %v`. This is a fatal plugin initialization failure — the plugin's runtime never gets its modules or script loaded.
Source
Thrown at kernel/plugin/plugin.go:192
})
p.agentCapabilities.Clear()
}
// updateState updates the plugin state atomically and pushes the new state to the frontend via util.PushKernelPluginState.
func (p *KernelPlugin) updateState(state PluginState) {
p.state.Store(int64(state))
util.PushKernelPluginState(p.Name, int(state))
}
// InitRuntime initializes the goja runtime and evaluates kernel.js.
func (p *KernelPlugin) InitRuntime() (err error) {
p.runtime = eventloop.NewEventLoop(eventloop.EnableConsole(true))
p.worker.Start(p.runtime)
p.runtime.Run(func(rt *goja.Runtime) {
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("goja panic during event loop run: %v", r)
}
}()
// Use JSON struct tags for field name mapping, with fallback to original names if "json" tag is absent.
rt.SetFieldNameMapper(goja.TagFieldNameMapper("json", true))
if enableErr := EnableExtendModules(p, rt); enableErr != nil {
err = fmt.Errorf("EnableExtendModules: %v", enableErr)
return
}
if enableErr := EnableSiyuanModule(p, rt); enableErr != nil {
err = fmt.Errorf("EnableSiyuanModule: %v", enableErr)
return
}
if _, runErr := rt.RunScript(p.file, p.Kernel.JS); runErr != nil {
err = fmt.Errorf("RunScript: %v", runErr)View on GitHub (pinned to 8641553a1f)
Solutions
- Read the panic value in the message to find the nil/invalid value source in the kernel code
- Verify the plugin's kernel.js content was downloaded/loaded intact (not empty or truncated)
- Restart the plugin (disable then enable) to rule out a transient race during start
- Update SiYuan; if reproducible, file an issue with the panic message and plugin name
Defensive patterns
Strategy: fallback
Try / catch
if err := plugin.Start(); err != nil { log.Warnf("plugin failed to init: %v; skipping", err) } Prevention
- Avoid rapid enable/disable cycles on plugins
- Verify plugin packages download completely (check kernel.js is non-empty)
- Keep SiYuan updated so goja/eventloop stay in sync
- Watch kernel logs at startup for the first failing plugin
When it happens
Trigger: A panic inside the `rt.Run(func(rt *goja.Runtime){...})` body during `InitRuntime` — typically a nil pointer or lo.Must assertion failure while registering extend/siyuan modules, before the Enable* wrappers convert their own errors.
Common situations: A kernel build with mismatched goja/eventloop versions, a plugin descriptor (Kernel.JS) that is nil or malformed causing script access panics, or concurrent start/stop of the same plugin racing on the runtime.
Related errors
- goja panic during close runtime: %v
- goja panic during start: %v
- start runtime: %v
- injectAgent: %v
- injectPlugin: %v
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/c44ed093db6a41a0.
Report an issue: GitHub.