siyuan-note/siyuan · error

panic during siyuan.storage.get: %v

Error message

panic during siyuan.storage.get: %v

What it means

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).

Source

Thrown at kernel/plugin/api_storage.go:174

		} else {
			argErr = fmt.Errorf("path required")
		}

		runErr := p.worker.Run(func(rt *goja.Runtime) (result any, err error) {
			if argErr != nil {
				err = argErr
				return
			}
			abs, resolveErr := resolvePath(path)
			if resolveErr != nil {
				err = resolveErr
				return
			}

			go func() (result []byte, err error) {
				defer func() {
					if r := recover(); r != nil {
						err = fmt.Errorf("panic during siyuan.storage.get: %v", r)
					}
					p.worker.Run(func(rt *goja.Runtime) (_ any, _ error) {
						if err != nil {
							return nil, err
						}

						content := rt.NewObject()
						if err = ObjectSetDataMethods(p, rt, content, result); err != nil {
							return nil, err
						}

						return content, nil
					}, func(rt *goja.Runtime, result any, err error) {
						if lo.IsNil(err) {
							if resolveErr := resolve(result); resolveErr != nil {
								logging.LogErrorf("[plugin:%s] siyuan.storage.get resolve: %v", p.Name, resolveErr)
							}
						} else {

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Inspect the %v detail in the kernel log to find the panic site.
  2. Try reading a different known-good file to isolate whether the specific file content triggers it.
  3. Report the panic stack to the kernel maintainers with the file path and size.
  4. Wrap the get call in try/catch and fall back to a default value so the plugin keeps running.

Example fix

// before
const data = await siyuan.storage.get(path);
// after
let data;
try {
  data = await siyuan.storage.get(path);
} catch (e) {
  console.error('storage.get failed', e);
  data = defaultContent;
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
  return await siyuan.storage.get(path);
} catch (e) {
  if (/panic during siyuan.storage.get/.test(String(e))) {
    console.error('kernel panic reading', path, e);
    return defaultContent;
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/68155adf601b8faa. Report an issue: GitHub.