{"record":{"id":"44aaf75bf4342502","repo":"siyuan-note/siyuan","slug":"inspect-imported-notebook-s-failed-w","errorCode":null,"errorMessage":"inspect imported notebook [%s] failed: %w","messagePattern":"inspect imported notebook \\[(.+?)\\] failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/import.go","lineNumber":1087,"sourceCode":"\t\tvar boxCrypt *conf.BoxEncryption\n\t\tif boxConf != nil && boxConf.Encrypted {\n\t\t\tif boxConf.BoxCrypt != nil && validateBoxEncryption(boxConf.BoxCrypt) == nil {\n\t\t\t\tboxCrypt = boxConf.BoxCrypt\n\t\t\t} else {\n\t\t\t\tboxCrypt = backup\n\t\t\t}\n\t\t\tif boxCrypt == nil {\n\t\t\t\treturn nil, fmt.Errorf(\"encrypted notebook [%s] has no valid identity\", boxID)\n\t\t\t}\n\t\t} else if boxConf != nil && backup != nil {\n\t\t\treturn nil, fmt.Errorf(\"notebook [%s] has conflicting normal and encrypted identities\", boxID)\n\t\t} else if backup != nil {\n\t\t\tboxCrypt = backup\n\t\t}\n\n\t\tpayloadFound, payloadErr := hasEncryptedNotebookPayloadAtPath(boxDir)\n\t\tif payloadErr != nil {\n\t\t\treturn nil, fmt.Errorf(\"inspect imported notebook [%s] failed: %w\", boxID, payloadErr)\n\t\t}\n\t\tif boxCrypt == nil && payloadFound {\n\t\t\treturn nil, fmt.Errorf(\"imported notebook [%s] contains encrypted payload without identity\", boxID)\n\t\t}\n\t\tif boxCrypt == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif err = validateBoxEncryption(boxCrypt); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid imported notebook identity [%s]: %w\", boxID, err)\n\t\t}\n\t\tif filelock.IsExist(filepath.Join(util.DataDir, boxID)) && IsEncryptedBox(boxID) {\n\t\t\treturn nil, fmt.Errorf(\"refuse to overwrite existing encrypted notebook [%s]\", boxID)\n\t\t}\n\t\tencryptedBoxIDs = append(encryptedBoxIDs, boxID)\n\t}\n\treturn encryptedBoxIDs, nil\n}","sourceCodeStart":1069,"sourceCodeEnd":1105,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/import.go#L1069-L1105","documentation":"Thrown by validateImportedNotebookIdentities when hasEncryptedNotebookPayloadAtPath encounters an I/O error while walking the notebook directory tree. This function walks every file in the extracted notebook directory and reads the first 4 bytes of each to check for the encrypted-notebook data magic header. Any walk or read error is wrapped with the boxID and returned.","triggerScenarios":"Calling validateImportedNotebookIdentities where hasEncryptedNotebookPayloadAtPath(boxDir) returns a non-nil error. The walk at crypto.go:122-147 can fail on directory access errors, file open errors, or read errors on individual files. The check is at import.go:1085-1088.","commonSituations":"Permission denied on a subdirectory or file within the extracted notebook. Filesystem errors on the temp volume. Files deleted between the directory listing and the walk (race with cleanup). Symlink loops causing infinite traversal. Special files (device files, pipes) that cannot be read.","solutions":["Check permissions on all files and subdirectories within the notebook directory in the extracted Data.zip.","Re-export the Data.zip to rule out archive corruption.","Verify the temp extraction directory is on a healthy filesystem.","Inspect the wrapped error (%w) for the specific I/O error and path that caused the failure."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"encryptedBoxIDs, err := validateImportedNotebookIdentities(tmpDataPath)\nif err != nil {\n    if strings.Contains(err.Error(), \"inspect imported notebook\") {\n        // I/O error during encrypted payload scan\n        logging.LogErrorf(\"cannot scan notebook directory for encrypted payload: %s\", err)\n        // Suggest checking permissions or re-exporting\n    }\n}","preventionTips":["Verify file permissions on all files in the extracted Data.zip.","Re-export Data.zip if filesystem errors recur.","Check the health of the temp extraction volume.","Ensure no other process is modifying files in the temp directory during import."],"tags":["encryption","import","data-zip","io","inspection"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}