siyuan-note/siyuan · error
panic during siyuan.storage.put: %v
Error message
panic during siyuan.storage.put: %v
What it means
Thrown when a panic is recovered inside the goroutine that performs the file write for siyuan.storage.put(). The deferred recover() wraps the panic value into this message. It is a defensive boundary for unexpected runtime faults during directory creation or file writing, distinct from ordinary I/O errors which have their own messages (1014, 1015).
Source
Thrown at kernel/plugin/api_storage.go:260
if argErr != nil {
err = argErr
return
}
if util.ReadOnly {
err = fmt.Errorf("The current kernel is in read-only mode, storage.put is not allowed")
return
}
abs, resolveErr := resolvePath(path)
if resolveErr != nil {
err = resolveErr
return
}
go func() (result any, err error) {
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("panic during siyuan.storage.put: %v", r)
}
p.worker.Run(func(rt *goja.Runtime) (_ any, _ error) {
if lo.IsNil(err) {
if resolveErr := resolve(result); resolveErr != nil {
logging.LogErrorf("[plugin:%s] siyuan.storage.put resolve: %v", p.Name, resolveErr)
}
} else {
if rejectErr := reject(rt.NewGoError(err)); rejectErr != nil {
logging.LogErrorf("[plugin:%s] siyuan.storage.put reject: %v", p.Name, rejectErr)
}
}
return
}, nil)
}()
if mkdirErr := os.MkdirAll(filepath.Dir(abs), 0755); mkdirErr != nil {
err = fmt.Errorf("failed to make directory: %w", mkdirErr)View on GitHub (pinned to 251596fc0d)
Solutions
- Check the %v detail in the kernel log to locate the panic site.
- Retry the put once with the same arguments to rule out a transient teardown race.
- Report the panic with the path and content size if it reproduces.
- Wrap put in try/catch and keep an in-memory copy as a fallback.
Example fix
// before
await siyuan.storage.put(path, body);
// after
try {
await siyuan.storage.put(path, body);
} catch (e) {
console.error('storage.put panicked/failed', e);
memoryFallback.set(path, body);
} Defensive patterns
Strategy: try-catch
Try / catch
try {
await siyuan.storage.put(path, body);
} catch (e) {
if (/panic during siyuan.storage.put/.test(String(e))) {
memoryFallback.set(path, body);
return;
}
throw e;
} Prevention
- Keep an in-memory copy of important state so a write panic does not lose data.
- Avoid issuing writes during plugin teardown to dodge races.
When it happens
Trigger: A panic inside the write goroutine — e.g. nil dereference in filelock helpers, an assertion failure, or a runtime fault triggered by malformed path/content.
Common situations: Rare; indicates a kernel-level defect or an extreme edge case (corrupted state, concurrent teardown).
Related errors
- panic during siyuan.storage.get: %v
- panic during siyuan.storage.remove: %v
- import from local path failed, please check kernel log for d
- siyuan.storage: path traversal not allowed
- path required
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/a5fddff4d7f93b0f.
Report an issue: GitHub.