siyuan-note/siyuan · error
EnableExtendModules: %v
Error message
EnableExtendModules: %v
What it means
When initializing a plugin's goja runtime, the kernel first registers the extend modules (RPC, sockets, etc.) via `EnableExtendModules`. If that registration returns an error, it is wrapped as `EnableExtendModules: %v` and plugin startup fails. It means one of the extended API surfaces could not be installed into the plugin's JS runtime.
Source
Thrown at kernel/plugin/plugin.go:200
}
// 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)
return
}
})
p.runtime.Start()
return
}
// Eval evaluates JavaScript code in the plugin's goja runtime, returning the result or error.View on GitHub (pinned to 8641553a1f)
Solutions
- Inspect the wrapped inner error in the log for the specific module that failed to enable
- Restart the plugin to rule out a duplicate-start race
- Update SiYuan kernel if the inner error points at module registration code
- Report with plugin name and full error if reproducible
Defensive patterns
Strategy: fallback
Try / catch
if err := plugin.Start(); err != nil && strings.Contains(err.Error(), "EnableExtendModules") { // disable plugin and retry once after restart } Prevention
- Restart the kernel after upgrading SiYuan before enabling plugins
- Do not start the same plugin concurrently
- Check kernel logs for the wrapped inner module error
- Report persistent failures with the inner error text
When it happens
Trigger: Any error returned by EnableExtendModules during InitRuntime — e.g. lo.Must assertions on module property registration failing, or a sub-registration (RPC method table, socket API) returning an error.
Common situations: Kernel-side bugs after an upgrade where module registration code asserts on frozen objects, or a plugin started twice concurrently so runtime state is inconsistent.
Related errors
- EnableSiyuanModule: %v
- goja panic during event loop run: %v
- RunScript: %v
- goja panic during close runtime: %v
- goja panic during start: %v
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/0f7a4d010e12369a.
Report an issue: GitHub.