siyuan-note/siyuan · error
Conf.Language(0)
Error message
Conf.Language(0)
What it means
RenameBox looks up the notebook by boxID via Conf.Box; if no notebook with that ID exists it immediately returns the localized message for language key 0 ("file not found" style message). This is the notebook-not-found guard before any rename work happens, surfaced through renameNotebook and related API/mobile callers.
Source
Thrown at kernel/model/mount.go:138
minSort, maxSort := boxes[0].Sort, boxes[0].Sort
for _, box := range boxes[1:] {
if box.Sort < minSort {
minSort = box.Sort
}
if maxSort < box.Sort {
maxSort = box.Sort
}
}
if atTop {
return minSort - 1
}
return maxSort + 1
}
func RenameBox(boxID, name string) (err error) {
box := Conf.Box(boxID)
if nil == box {
return errors.New(Conf.Language(0))
}
name = normalizeBoxName(name)
if 512 < utf8.RuneCountInString(name) {
// 限制笔记本名和文档名最大长度为 `512` https://github.com/siyuan-note/siyuan/issues/6299
err = errors.New(Conf.Language(106))
return
}
boxConf := box.GetConf()
boxConf.Name = name
box.Name = name
if err = box.SaveConf(boxConf); err != nil {
logging.LogErrorf("save box conf [%s] failed: %s", boxID, err)
return
}
if err = renameBoxDoc(boxID, name); err != nil {
logging.LogErrorf("rename box document [box=%s] failed: %s", boxID, err)View on GitHub (pinned to 8641553a1f)
Solutions
- Fetch the current notebook list (/api/notebook/lsNotebooks) and verify the boxID exists before renaming.
- Refresh stale client-side notebook caches after sync or after another client modifies notebooks.
- Correct the boxID — IDs are 22-character node-ID strings, not names.
Example fix
// before
renameNotebook("20240101120000-abc1234", "New Name"); // stale ID
// after
const notebooks = await lsNotebooks();
if (notebooks.some(n => n.id === boxId)) {
renameNotebook(boxId, "New Name");
} Defensive patterns
Strategy: validation
Validate before calling
async function notebookExists(boxId) {
const r = await fetchPost("/api/notebook/lsNotebooks", {});
return r.data.notebooks.some(n => n.id === boxId);
} Try / catch
try {
await renameNotebook(boxId, name);
} catch (e) {
if (isLocalizedKernelError(e)) {
await refreshNotebookList(); // boxID no longer exists — resync cache
}
} Prevention
- Re-fetch lsNotebooks before renaming instead of trusting cached IDs.
- Treat the localized key-0 error as 'notebook gone' and refresh state.
- Never hardcode notebook IDs in scripts — look them up by name at runtime.
When it happens
Trigger: Calling /api/notebook/renameNotebook with a boxID that was already removed, was never created, is a stale ID cached in the client, or has a typo/wrong casing.
Common situations: Clients holding notebook lists from before a sync/deletion; concurrent deletion by another client or window; scripts renaming notebooks from hardcoded IDs; workspace switched without refreshing the notebook list.
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
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/8acc3e6d45e0ec93.
Report an issue: GitHub.