siyuan-note/siyuan · error
can not get or create rollback box
Error message
can not get or create rollback box
What it means
getRollbackBox resolves (or lazily creates) the special history box used to stage rollback operations. If, after looking up the configured box ID and attempting creation, no *conf.Box can be produced, this sentinel error is returned. It means the rollback cannot proceed because the target box object is unavailable.
Solutions
- Restart the kernel so box registration is rebuilt from the data directory.
- Ensure the workspace data directory exists and is writable by the kernel process.
- Check kernel logs just before this error for the box-creation failure cause and fix it.
- Do not manually delete/rename the internal history box directories under data/history or data/<box> while SiYuan runs.
- Retry the rollback after the box is restored; if data was damaged, restore the workspace from backup/sync snapshot.
Example fix
// guard the caller before performing rollback
box, err := getRollbackBox()
if err != nil {
return fmt.Errorf("rollback aborted, history box unavailable: %w", err)
} Defensive patterns
Strategy: try-catch
Validate before calling
// before rollback, verify the history box exists
if Conf.Box(historyBoxID) == nil {
return fmt.Errorf("rollback box %s not available; restart kernel to re-register boxes", historyBoxID)
} Try / catch
box, err := getRollbackBox()
if err != nil {
logging.LogErrorf("rollback unavailable: %v", err)
return err
} Prevention
- Do not manually delete or rename internal box directories while the kernel runs
- Restart the kernel after any manual workspace manipulation
- Keep the data directory writable by the kernel process
When it happens
Trigger: RollbackDocHistory or RollbackRepoSnapshotFile calls getRollbackBox; the history-box ID is not a known box, the creation path fails or produces a box object that is still nil (e.g. invalid ID format, workspace data dir not writable so the box directory could not be created/registered).
Common situations: Workspace data directory permissions dropped; the internal history box was manually deleted or renamed on disk while the kernel is running; corrupt or hand-edited configuration pointing the rollback box at an invalid ID; a previously failed creation left inconsistent state.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Conf.Language(371)
- encrypted attribute view history is missing notebook context
- parse document history failed
- parse document history failed
- attribute view history context is ambiguous
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/2aeb926d410fd754.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/history.go:1464
if nil == ret {
boxName := "Rollback"
ret = GetBoxByName(boxName)
if nil == ret {
var id string
id, err = CreateBox(boxName)
if nil != err {
return
}
_, err = Mount(id)
if nil != err {
return
}
ret = Conf.Box(id)
created = true
}
}
if nil == ret {
err = errors.New("can not get or create rollback box")
return
}
return
}
View on GitHub (pinned to 9f775e8a12)