{"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":1370,"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":1352,"sourceCodeEnd":1388,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/import.go#L1352-L1388","documentation":"As a final safety check, validateImportedNotebookIdentities probes the imported notebook directory with hasEncryptedNotebookPayloadAtPath to detect whether the payload is actually encrypted. If that inspection itself errors (unreadable files, IO failure walking the tree), it returns 'inspect imported notebook [%s] failed' wrapping the cause; a reliable verdict is required before deciding the notebook may enter the workspace.","triggerScenarios":"ImportData where hasEncryptedNotebookPayloadAtPath(boxDir) returns an error while scanning the imported notebook — unreadable .sy files, permission errors, symlinks pointing outside, or IO failures during the scan.","commonSituations":"1) Partially extracted or truncated archive. 2) Files restored from backup with wrong ACLs/ownership. 3) Cloud-sync placeholder files failing to hydrate on access. 4) Failing storage device during import.","solutions":["Read the wrapped payloadErr in the kernel log to find which file failed and why; fix that file's permissions or restore it.","Re-extract or re-export the import archive to get a complete, readable notebook directory.","Disable 'files on-demand' / placeholder mode for the workspace on cloud-synced folders so files hydrate locally before import.","Retry ImportData after verifying all .sy files inside the imported box directory are readable by the kernel process."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"for (const f of await fs.promises.readdir(path.join(boxDir), {recursive: true})) {\n  await fs.promises.access(f, fs.constants.R_OK); // ensure the whole notebook tree is readable\n}","typeGuard":null,"tryCatchPattern":"try {\n  await importData(src);\n} catch (e) {\n  if (/inspect imported notebook/.test(e.msg)) {\n    console.error('Fix unreadable files inside the imported notebook dir (see wrapped payloadErr), then retry');\n  }\n  throw e;\n}","preventionTips":["Ensure archive extraction is complete and files hydrate locally before import (disable cloud placeholders)","Fix ownership/ACLs after restoring workspaces from external backups","Pre-scan imported notebook directories for unreadable files or dangling symlinks"],"tags":["filesystem","inspection","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"}