{"record":{"id":"24b4a30ab812cf80","repo":"siyuan-note/siyuan","slug":"start-runtime-v","errorCode":null,"errorMessage":"start runtime: %v","messagePattern":"start runtime: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/plugin/plugin.go","lineNumber":274,"sourceCode":"func (p *KernelPlugin) start() (err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = fmt.Errorf(\"goja panic during start: %v\", r)\n\t\t}\n\t\tif err != nil {\n\t\t\tp.error()\n\t\t}\n\t}()\n\n\tp.updateState(PluginStateLoading)\n\n\tbaseDir := filepath.Join(util.DataDir, \"storage\", \"petal\", p.Name)\n\tif err := os.MkdirAll(baseDir, 0755); err != nil {\n\t\treturn fmt.Errorf(\"create plugin dir [%s] failed: %s\", baseDir, err)\n\t}\n\n\tif runtimeErr := p.InitRuntime(); runtimeErr != nil {\n\t\treturn fmt.Errorf(\"start runtime: %v\", runtimeErr)\n\t}\n\n\tif subscribeErr := p.subscribeEventHandlers(); subscribeErr != nil {\n\t\treturn fmt.Errorf(\"subscribe plugin events: %v\", subscribeErr)\n\t}\n\n\tp.onLoad()\n\tp.updateState(PluginStateRunning)\n\tp.onRunning()\n\n\tp.bus.Publish(EventBusTopicRuntime, createEventMessage(\"start\", nil))\n\n\tlogging.LogDebugf(\"[plugin:%s] started\", p.Name)\n\treturn\n}\n\n// stop cleanly shuts down the plugin: closes sockets, frees goja runtime.\nfunc (p *KernelPlugin) stop() (ok bool, err error) {","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/plugin/plugin.go#L256-L292","documentation":"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.","triggerScenarios":"InitRuntime returning any error during StartPlugin — the inner message (goja panic, EnableExtendModules, EnableSiyuanModule, RunScript) names the root cause.","commonSituations":"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.","solutions":["Read the full wrapped message — everything after 'start runtime: ' is the root cause","If it's a RunScript error, reinstall/update the plugin (likely incompatible or corrupt bundle)","If it's a module/panic error, restart the kernel and re-enable the plugin","If persistent, report to the plugin author with the full error and SiYuan version"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := StartPlugin(p); err != nil { if strings.Contains(err.Error(), \"start runtime:\") { log.Errorf(\"plugin %s runtime init failed: %v\", p.Name, err); } }","preventionTips":["Parse the wrapped inner message to get the real root cause","Reinstall the plugin when the inner cause is RunScript","Restart the kernel when the inner cause is a module/panic error","Verify plugin-SiYuan version compatibility before enabling"],"tags":["goja","plugin-lifecycle","startup","runtime"],"backgroundTag":"module-init-failed","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}