{"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":1053,"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":1035,"sourceCodeEnd":1071,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/import.go#L1035-L1071","documentation":"Thrown by validateImportedNotebookIdentities during Data.zip import when filelock.ReadFile fails reading the .siyuan/conf.json of an imported notebook. The conf.json file was confirmed to exist via filelock.IsExist, but the subsequent read returned an error. The error wraps the underlying I/O error with the boxID for context.","triggerScenarios":"Calling validateImportedNotebookIdentities (from ImportData) where a notebook directory under the extracted Data.zip contains a .siyuan/conf.json that exists but cannot be read. The check is at import.go:1050-1053.","commonSituations":"Permission denied on the conf.json file. File deleted between the IsExist check and the ReadFile call (race condition). Filesystem error on the temp volume. Corrupted filesystem sector. File locked exclusively by another process.","solutions":["Check file permissions on the .siyuan/conf.json inside the Data.zip's notebook directory.","Re-export the Data.zip from the source SiYuan instance to rule out archive corruption.","Verify the temp directory used for extraction is writable and not on a failing disk.","Inspect the wrapped error (%w) in the returned error for the specific filesystem error code."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before validateImportedNotebookIdentities, pre-check conf.json readability\nfunc preCheckConfReadable(tmpDataPath, boxID string) error {\n    confPath := filepath.Join(tmpDataPath, boxID, \".siyuan\", \"conf.json\")\n    if !filelock.IsExist(confPath) {\n        return nil // absent is fine\n    }\n    f, err := os.Open(confPath)\n    if err != nil {\n        return fmt.Errorf(\"conf.json for notebook %s is not readable: %w\", boxID, err)\n    }\n    f.Close()\n    return nil\n}","typeGuard":null,"tryCatchPattern":"encryptedBoxIDs, err := validateImportedNotebookIdentities(tmpDataPath)\nif err != nil {\n    if strings.Contains(err.Error(), \"read imported notebook conf\") {\n        // The conf.json exists but is unreadable — suggest re-export\n        logging.LogErrorf(\"conf.json read failed during import: %s\", err)\n    }\n}","preventionTips":["Re-export Data.zip from the source SiYuan to ensure all files are intact.","Verify file permissions in the archive before importing.","Check that the extraction temp directory has proper read permissions."],"tags":["encryption","import","data-zip","config","io"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}