{"record":{"id":"68155adf601b8faa","repo":"siyuan-note/siyuan","slug":"panic-during-siyuan-storage-get-v","errorCode":null,"errorMessage":"panic during siyuan.storage.get: %v","messagePattern":"panic during siyuan\\.storage\\.get: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/plugin/api_storage.go","lineNumber":174,"sourceCode":"\t\t} else {\n\t\t\targErr = fmt.Errorf(\"path required\")\n\t\t}\n\n\t\trunErr := p.worker.Run(func(rt *goja.Runtime) (result any, err error) {\n\t\t\tif argErr != nil {\n\t\t\t\terr = argErr\n\t\t\t\treturn\n\t\t\t}\n\t\t\tabs, resolveErr := resolvePath(path)\n\t\t\tif resolveErr != nil {\n\t\t\t\terr = resolveErr\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tgo func() (result []byte, err error) {\n\t\t\t\tdefer func() {\n\t\t\t\t\tif r := recover(); r != nil {\n\t\t\t\t\t\terr = fmt.Errorf(\"panic during siyuan.storage.get: %v\", r)\n\t\t\t\t\t}\n\t\t\t\t\tp.worker.Run(func(rt *goja.Runtime) (_ any, _ error) {\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcontent := rt.NewObject()\n\t\t\t\t\t\tif err = ObjectSetDataMethods(p, rt, content, result); err != nil {\n\t\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn content, nil\n\t\t\t\t\t}, func(rt *goja.Runtime, result any, err error) {\n\t\t\t\t\t\tif lo.IsNil(err) {\n\t\t\t\t\t\t\tif resolveErr := resolve(result); resolveErr != nil {\n\t\t\t\t\t\t\t\tlogging.LogErrorf(\"[plugin:%s] siyuan.storage.get resolve: %v\", p.Name, resolveErr)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/plugin/api_storage.go#L156-L192","documentation":"Thrown when a panic is recovered inside the goroutine that performs the actual file read for siyuan.storage.get(). The deferred recover() wraps the runtime panic value into this message. This is a defensive guard: the panic is not user-facing argument validation but an unexpected failure in the read path (e.g. nil dereference in a called helper, OOM, or an unforeseen runtime fault).","triggerScenarios":"A panic inside file reading helpers invoked from the get goroutine — for example a nil pointer when the resolved file info is malformed, or a panic inside ObjectSetDataMethods while building the returned content object.","commonSituations":"Very rare; typically surfaces from a kernel bug or a corrupted storage entry. May correlate with edge cases such as empty files, broken symlinks, or a content type the data-methods helper cannot encode.","solutions":["Inspect the %v detail in the kernel log to find the panic site.","Try reading a different known-good file to isolate whether the specific file content triggers it.","Report the panic stack to the kernel maintainers with the file path and size.","Wrap the get call in try/catch and fall back to a default value so the plugin keeps running."],"exampleFix":"// before\nconst data = await siyuan.storage.get(path);\n// after\nlet data;\ntry {\n  data = await siyuan.storage.get(path);\n} catch (e) {\n  console.error('storage.get failed', e);\n  data = defaultContent;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  return await siyuan.storage.get(path);\n} catch (e) {\n  if (/panic during siyuan.storage.get/.test(String(e))) {\n    console.error('kernel panic reading', path, e);\n    return defaultContent;\n  }\n  throw e;\n}","preventionTips":["Never assume storage.get cannot panic; always catch on the read path.","Report reproducing panics with the file path and size to kernel maintainers."],"tags":["plugin-api","storage","panic","recovery","defensive"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}