{"record":{"id":"1d3ff8d94f8facf5","repo":"siyuan-note/siyuan","slug":"load-created-shorthand-document-s-failed-w","errorCode":null,"errorMessage":"load created shorthand document [%s] failed: %w","messagePattern":"load created shorthand document \\[(.+?)\\] failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/shortcuts.go","lineNumber":325,"sourceCode":"\tif err = verifyShorthandDocPersisted(bt, retID); nil != err {\n\t\treturn\n\t}\n\tbox.setSortByConf(path.Dir(bt.Path), retID)\n\n\tFlushTxQueue()\n\tPushCreate(box, bt.Path, nil)\n\treturn\n}\n\nfunc verifyShorthandDocPersisted(bt *treenode.BlockTree, expectedID string) (err error) {\n\tif nil == bt {\n\t\treturn fmt.Errorf(\"get block tree by id [%s] failed after create\", expectedID)\n\t}\n\t// 清除写入缓存，确保从文件系统重新读取并验证文档。\n\tcache.RemoveTreeDataInBox(expectedID, bt.BoxID)\n\tpersisted, err := loadTreeByBlockTree(bt)\n\tif nil != err {\n\t\treturn fmt.Errorf(\"load created shorthand document [%s] failed: %w\", expectedID, err)\n\t}\n\tif nil == persisted || persisted.ID != expectedID {\n\t\treturn fmt.Errorf(\"verify created shorthand document [%s] failed\", expectedID)\n\t}\n\treturn nil\n}\n\nvar consumeShorthandsLock = sync.Mutex{}\nvar shorthandSaveBoxUnavailableNotified bool\n\nfunc isShorthandSaveBoxAvailable(box *Box) bool {\n\treturn nil != box && !box.Closed && !box.Encrypted && !IsUserGuide(box.ID)\n}\n\nfunc selectShorthandSaveBox(configuredID string, boxes []*Box) *Box {\n\tif \"\" != configuredID {\n\t\tfor _, box := range boxes {\n\t\t\tif nil != box && box.ID == configuredID && isShorthandSaveBoxAvailable(box) {","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/shortcuts.go#L307-L343","documentation":"As part of persistence verification, verifyShorthandDocPersisted clears the tree cache and reloads the document from disk via loadTreeByBlockTree. If that reload fails, the created shorthand document cannot be read back from the filesystem and the error \"load created shorthand document [%s] failed: %w\" wraps the underlying cause.","triggerScenarios":"loadTreeByBlockTree returns an error right after creation — unreadable/corrupt .sy file on disk, missing file despite a recorded block tree entry, disk I/O or permission problems, or parse failures on the freshly written XML.","commonSituations":"Full disk or antivirus interference preventing the .sy write; permission issues in the data directory; sync processes rewriting the file mid-verification.","solutions":["Inspect the wrapped cause (%w) to see whether it is I/O, permission, or parse failure and fix that first","Check disk space and file permissions in the workspace data directory","Retry after excluding the workspace from antivirus/backup tooling that may lock new files"],"exampleFix":"// before\npersisted, err := loadTreeByBlockTree(bt)\n// after\npersisted, err := loadTreeByBlockTree(bt)\nif err != nil {\n    logging.LogErrorf(\"reload shorthand doc %s: %v\", expectedID, err) // surface the wrapped cause\n}","handlingStrategy":"try-catch","validationCode":"const st = await api.getFileStats(dataDir)\nif (st.freeBytes < 10 * 1024 * 1024) throw new Error('insufficient disk space for document creation')","typeGuard":null,"tryCatchPattern":"try { await createShorthand(boxID, hPath, dom) } catch (e) { if (String(e).includes('load created shorthand document')) { logCause(e); checkDiskAndPermissions(); } throw e }","preventionTips":["Monitor free disk space in the workspace volume","Exclude the data directory from antivirus/backup locking","Fix the wrapped cause error first — it names the actual I/O or parse failure"],"tags":["file-read-failed","persistence","siyuan"],"backgroundTag":"file-read-failed","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}