{"record":{"id":"6ad0e193c39742c6","repo":"siyuan-note/siyuan","slug":"query-notebook-failed","errorCode":null,"errorMessage":"Query notebook failed","messagePattern":"Query notebook failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/assets.go","lineNumber":1207,"sourceCode":"\t\t\tif rootEvalErr != nil {\n\t\t\t\treturn \"\", fmt.Errorf(\"resolve assets root [%s] failed: %w\", assetsRoot, rootEvalErr)\n\t\t\t}\n\t\t\tif !gulu.File.IsSubPath(realAssetsRoot, realP) {\n\t\t\t\treturn \"\", fmt.Errorf(\"symlink [%s] resolves outside data/assets: [%s]\", p, realP)\n\t\t\t}\n\t\t\t// 安全校验使用解析后的路径，返回原路径以便下游与 DataDir 保持同一路径形式\n\t\t\treturn p, nil\n\t\t}\n\t\treturn p, nil\n\t}\n\n\t// 在文档同级 assets 文件夹下搜索\n\tif !strings.HasPrefix(relativePath, \"assets/\") {\n\t\treturn \"\", nil\n\t}\n\tnotebooks, err := ListNotebooks()\n\tif err != nil {\n\t\treturn \"\", errors.New(Conf.Language(0))\n\t}\n\tfor _, notebook := range notebooks {\n\t\tif !includeEncrypted && IsEncryptedBox(notebook.ID) {\n\t\t\tcontinue // 加密笔记本的资源不参与全局路径解析（孤岛，资源不跨边界）\n\t\t}\n\t\tnotebookAbsPath := filepath.Join(util.DataDir, notebook.ID)\n\t\tfilelock.Walk(notebookAbsPath, func(path string, d fs.DirEntry, err error) error {\n\t\t\tif isSkipFile(d.Name()) {\n\t\t\t\tif d.IsDir() {\n\t\t\t\t\treturn filepath.SkipDir\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif p := filepath.ToSlash(path); strings.HasSuffix(p, relativePath) {\n\t\t\t\tif gulu.File.IsExist(path) {\n\t\t\t\t\tabsPath = path\n\t\t\t\t\treturn fs.SkipAll\n\t\t\t\t}","sourceCodeStart":1189,"sourceCodeEnd":1225,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/afa823b6b4e4f183511e0bc0a3be93caa94c7c97/kernel/model/assets.go#L1189-L1225","documentation":"During the document-level assets search, getAssetAbsPath calls ListNotebooks(); failure returns the localized 'Query notebook failed' (Conf.Language(0)). The cause is workspace-level I/O or index trouble - the notebook listing under data/ could not be read - not a problem with the specific asset.","triggerScenarios":"The kernel cannot read the data/ directory (permissions or ownership), the notebook index is corrupt, the disk or network share holding the workspace is failing, or the workspace was moved while the kernel was running.","commonSituations":"Workspace on a NAS/external drive that dropped; permissions changed by security software; workspace copied between machines under different user accounts.","solutions":["Verify the kernel process can read <workspace>/data and fix ownership/permissions","Restart the kernel so the notebook list is rebuilt","Move the workspace back to healthy local storage and reopen it","If the volume reports errors, repair it before continuing"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if f, err := os.Open(util.DataDir); err != nil {\n\t// data dir unreadable: fix permissions/mount before resolving assets\n} else {\n\tf.Close()\n}","typeGuard":null,"tryCatchPattern":"On this error, retry the whole resolution once after confirming data/ is readable; persistent failure means an environment problem (disk, mount, permissions), not an asset problem.","preventionTips":["Keep the workspace on local, healthy disks","Avoid moving or unmounting the workspace while the kernel runs","Run the kernel as the user who owns the workspace files"],"tags":["filesystem","notebook","io-error","i18n"],"backgroundTag":"filesystem-io-error","analyzedSha":"afa823b6b4e4f183511e0bc0a3be93caa94c7c97","analyzedAt":"2026-08-18T17:04:10.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}