{"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":323,"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":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/shortcuts.go#L305-L341","documentation":"verifyShorthandDocPersisted clears write caches and reloads the tree from the filesystem via loadTreeByBlockTree. If that reload returns an error, the failure is wrapped as \"load created shorthand document [%s] failed: %w\". The document record exists but its .sy content could not be read back, indicating a write/read or parse problem right after creation.","triggerScenarios":"createShorthandDocByDOM registered the block tree entry, but loadTreeByBlockTree fails when re-reading — unreadable or corrupt .sy file, file lock held, or disk I/O error.","commonSituations":"Antivirus/backup software locking fresh files; disk full so the .sy write was truncated; concurrent sync or move operations touching the same path; parse failure due to malformed generated DOM.","solutions":["Retry after resolving file-system access (check disk space, close processes locking the file, pause antivirus/backup)","Check kernel logs for the wrapped inner error to identify the exact load failure","If the .sy file is corrupt, delete the bad shorthand document and re-capture the shorthand"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := verifyShorthandDocPersisted(bt, expectedID); err != nil {\n    var wrapped interface{ Unwrap() error }\n    if errors.As(err, &inner); strings.HasPrefix(err.Error(), \"load created shorthand document\") {\n        logging.LogErrorf(\"shorthand doc unreadable: %v\", inner) // inspect inner cause\n    }\n}","preventionTips":["Check disk space and file locks before bulk shorthand consumption","Exclude the workspace from aggressive antivirus/backup scanners","Verify generated DOM parses to a valid tree before writing the .sy file"],"tags":["shorthands","file-read","persistence"],"backgroundTag":"file-read-failed","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"}