{"record":{"id":"8acc3e6d45e0ec93","repo":"siyuan-note/siyuan","slug":"conf-language-0-8acc3e","errorCode":null,"errorMessage":"Conf.Language(0)","messagePattern":"Conf\\.Language\\(0\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/mount.go","lineNumber":138,"sourceCode":"\tminSort, maxSort := boxes[0].Sort, boxes[0].Sort\n\tfor _, box := range boxes[1:] {\n\t\tif box.Sort < minSort {\n\t\t\tminSort = box.Sort\n\t\t}\n\t\tif maxSort < box.Sort {\n\t\t\tmaxSort = box.Sort\n\t\t}\n\t}\n\tif atTop {\n\t\treturn minSort - 1\n\t}\n\treturn maxSort + 1\n}\n\nfunc RenameBox(boxID, name string) (err error) {\n\tbox := Conf.Box(boxID)\n\tif nil == box {\n\t\treturn errors.New(Conf.Language(0))\n\t}\n\n\tname = normalizeBoxName(name)\n\tif 512 < utf8.RuneCountInString(name) {\n\t\t// 限制笔记本名和文档名最大长度为 `512` https://github.com/siyuan-note/siyuan/issues/6299\n\t\terr = errors.New(Conf.Language(106))\n\t\treturn\n\t}\n\n\tboxConf := box.GetConf()\n\tboxConf.Name = name\n\tbox.Name = name\n\tif err = box.SaveConf(boxConf); err != nil {\n\t\tlogging.LogErrorf(\"save box conf [%s] failed: %s\", boxID, err)\n\t\treturn\n\t}\n\tif err = renameBoxDoc(boxID, name); err != nil {\n\t\tlogging.LogErrorf(\"rename box document [box=%s] failed: %s\", boxID, err)","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/mount.go#L120-L156","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nrenameNotebook(\"20240101120000-abc1234\", \"New Name\"); // stale ID\n// after\nconst notebooks = await lsNotebooks();\nif (notebooks.some(n => n.id === boxId)) {\n  renameNotebook(boxId, \"New Name\");\n}","handlingStrategy":"validation","validationCode":"async function notebookExists(boxId) {\n  const r = await fetchPost(\"/api/notebook/lsNotebooks\", {});\n  return r.data.notebooks.some(n => n.id === boxId);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await renameNotebook(boxId, name);\n} catch (e) {\n  if (isLocalizedKernelError(e)) {\n    await refreshNotebookList(); // boxID no longer exists — resync cache\n  }\n}","preventionTips":["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."],"tags":["notebook","not-found","rename"],"backgroundTag":"resource-not-found","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}