siyuan-note/siyuan · error

EnableSiyuanModule: %v

Error message

EnableSiyuanModule: %v

What it means

After extend modules, `EnableSiyuanModule` installs the `siyuan` namespace (storage, events, etc.) into the plugin runtime. An error there is wrapped as `EnableSiyuanModule: %v` and aborts plugin startup. The plugin will end in PluginStateError and its capabilities are cleared.

Source

Thrown at kernel/plugin/plugin.go:205

	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.
func (p *KernelPlugin) Eval(rt *goja.Runtime, code string) (goja.Value, error) {
	return rt.RunScript(p.file, code)
}

// close interrupts the goja runtime and clears the pointer.

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Read the wrapped inner error to identify which siyuan sub-module (storage, events, etc.) failed
  2. Disable and re-enable the plugin for a fresh runtime
  3. Restart the SiYuan kernel if multiple plugins show the same failure
  4. Update SiYuan; report with the full error if persistent
Defensive patterns

Strategy: fallback

Try / catch

if err := plugin.Start(); err != nil && strings.Contains(err.Error(), "EnableSiyuanModule") { // mark plugin errored, surface to UI }

Prevention

When it happens

Trigger: EnableSiyuanModule returning an error while registering the siyuan object (e.g. assertion failure setting a frozen property on the runtime), during InitRuntime before the plugin's kernel.js is executed.

Common situations: Kernel upgrade inconsistencies, corrupted runtime state from a previous failed start, or resource exhaustion inside goja.

Related errors


AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11). Data as JSON: /api/errors/092b284731a65112. Report an issue: GitHub.