siyuan-note/siyuan · error

start runtime: %v

Error message

start runtime: %v

What it means

After creating the plugin directory, `start` calls `p.InitRuntime()` to build the goja event loop and evaluate kernel.js. Any error from that whole sequence (panics 1692, module failures 1693/1694, script errors 1695) is wrapped here as `start runtime: %v`. It is the generic outer wrapper for all plugin runtime initialization failures.

Source

Thrown at kernel/plugin/plugin.go:274

func (p *KernelPlugin) start() (err error) {
	defer func() {
		if r := recover(); r != nil {
			err = fmt.Errorf("goja panic during start: %v", r)
		}
		if err != nil {
			p.error()
		}
	}()

	p.updateState(PluginStateLoading)

	baseDir := filepath.Join(util.DataDir, "storage", "petal", p.Name)
	if err := os.MkdirAll(baseDir, 0755); err != nil {
		return fmt.Errorf("create plugin dir [%s] failed: %s", baseDir, err)
	}

	if runtimeErr := p.InitRuntime(); runtimeErr != nil {
		return fmt.Errorf("start runtime: %v", runtimeErr)
	}

	if subscribeErr := p.subscribeEventHandlers(); subscribeErr != nil {
		return fmt.Errorf("subscribe plugin events: %v", subscribeErr)
	}

	p.onLoad()
	p.updateState(PluginStateRunning)
	p.onRunning()

	p.bus.Publish(EventBusTopicRuntime, createEventMessage("start", nil))

	logging.LogDebugf("[plugin:%s] started", p.Name)
	return
}

// stop cleanly shuts down the plugin: closes sockets, frees goja runtime.
func (p *KernelPlugin) stop() (ok bool, err error) {

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Read the full wrapped message — everything after 'start runtime: ' is the root cause
  2. If it's a RunScript error, reinstall/update the plugin (likely incompatible or corrupt bundle)
  3. If it's a module/panic error, restart the kernel and re-enable the plugin
  4. If persistent, report to the plugin author with the full error and SiYuan version
Defensive patterns

Strategy: try-catch

Try / catch

if err := StartPlugin(p); err != nil { if strings.Contains(err.Error(), "start runtime:") { log.Errorf("plugin %s runtime init failed: %v", p.Name, err); } }

Prevention

When it happens

Trigger: InitRuntime returning any error during StartPlugin — the inner message (goja panic, EnableExtendModules, EnableSiyuanModule, RunScript) names the root cause.

Common situations: Any of: plugin kernel.js failing to parse/execute, module registration errors after a kernel upgrade, or goja panics from concurrent start attempts. Users typically see this while enabling a plugin in the marketplace/plugin panel.

Related errors


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