{"record":{"id":"b68074cb53921f44","repo":"siyuan-note/siyuan","slug":"read-imported-notebook-conf-s-failed-w","errorCode":null,"errorMessage":"read imported notebook conf [%s] failed: %w","messagePattern":"read imported notebook conf \\[(.+?)\\] failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/import.go","lineNumber":1336,"sourceCode":"\t\treturn nil, err\n\t}\n\n\tvar encryptedBoxIDs []string\n\tfor _, entry := range dirs {\n\t\tif !entry.IsDir() || !ast.IsNodeIDPattern(entry.Name()) {\n\t\t\tcontinue\n\t\t}\n\n\t\tboxID := entry.Name()\n\t\tboxDir := filepath.Join(tmpDataPath, boxID)\n\t\tconfPath := filepath.Join(boxDir, \".siyuan\", \"conf.json\")\n\t\tbackupPath := filepath.Join(boxDir, \".siyuan\", notebookCryptoBackupFilename)\n\n\t\tvar boxConf *conf.BoxConf\n\t\tif filelock.IsExist(confPath) {\n\t\t\tdata, readErr := filelock.ReadFile(confPath)\n\t\t\tif readErr != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"read imported notebook conf [%s] failed: %w\", boxID, readErr)\n\t\t\t}\n\t\t\tboxConf = conf.NewBoxConf()\n\t\t\tif unmarshalErr := gulu.JSON.UnmarshalJSON(data, boxConf); unmarshalErr != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parse imported notebook conf [%s] failed: %w\", boxID, unmarshalErr)\n\t\t\t}\n\t\t}\n\n\t\tvar backup *conf.BoxEncryption\n\t\tif filelock.IsExist(backupPath) {\n\t\t\tbackup, err = readBoxEncryptionFile(backupPath)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid imported notebook identity [%s]: %w\", boxID, err)\n\t\t\t}\n\t\t}\n\n\t\tvar boxCrypt *conf.BoxEncryption\n\t\tif boxConf != nil && boxConf.Encrypted {\n\t\t\tif boxConf.BoxCrypt != nil && validateBoxEncryption(boxConf.BoxCrypt) == nil {","sourceCodeStart":1318,"sourceCodeEnd":1354,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/import.go#L1318-L1354","documentation":"validateImportedNotebookIdentities, run by ImportData before notebooks are merged into the workspace, reads each imported notebook's .siyuan/conf.json via filelock.ReadFile. If that read fails (I/O error, lock, permission), it returns a wrapped 'read imported notebook conf [%s] failed' error naming the boxID, aborting the whole import since notebook identity (especially encryption identity) cannot be verified.","triggerScenarios":"ImportData encountering an imported notebook directory that contains .siyuan/conf.json but where reading that file fails — permission denied, file locked by another process, or disk/IO error during import extraction.","commonSituations":"1) Antivirus or a sync client (OneDrive/Dropbox) locking conf.json during import on Windows. 2) Partially extracted archive leaving conf.json unreadable or a broken symlink. 3) Workspace restored from backup with wrong ownership. 4) Failing disk sector.","solutions":["Check the kernel log / wrapped readErr for the underlying OS error and path, then fix that cause (permissions, lock, disk).","Re-extract or re-export the import archive so .siyuan/conf.json is intact and readable.","Exclude the workspace from antivirus/sync clients that hold files open, then retry ImportData.","Manually verify the file: open .siyuan/conf.json inside the imported notebook folder as the same user running the kernel; fix permissions if unreadable."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const confPath = path.join(boxDir, '.siyuan', 'conf.json');\nawait fs.promises.access(confPath, fs.constants.R_OK); // throws early if unreadable","typeGuard":null,"tryCatchPattern":"try {\n  await importData(src);\n} catch (e) {\n  if (/read imported notebook conf/.test(e.msg)) {\n    console.error('Fix permissions/locks on the imported notebook\\'s .siyuan/conf.json, then retry');\n  }\n  throw e;\n}","preventionTips":["Pause antivirus/sync clients that lock files during import","Verify archive extraction completed before importing","Check file readability of .siyuan/conf.json after moving workspaces across machines"],"tags":["filesystem","read","config","import","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"}