siyuan-note/siyuan · error
inspect imported notebook
Error message
inspect imported notebook [%s] failed: %w
What it means
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.
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.
Defensive patterns
Strategy: validation
Validate before calling
for (const f of await fs.promises.readdir(path.join(boxDir), {recursive: true})) {
await fs.promises.access(f, fs.constants.R_OK); // ensure the whole notebook tree is readable
} Try / catch
try {
await importData(src);
} catch (e) {
if (/inspect imported notebook/.test(e.msg)) {
console.error('Fix unreadable files inside the imported notebook dir (see wrapped payloadErr), then retry');
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/44aaf75bf4342502.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/import.go:1370
var boxCrypt *conf.BoxEncryption
if boxConf != nil && boxConf.Encrypted {
if boxConf.BoxCrypt != nil && validateBoxEncryption(boxConf.BoxCrypt) == nil {
boxCrypt = boxConf.BoxCrypt
} else {
boxCrypt = backup
}
if boxCrypt == nil {
return nil, fmt.Errorf("encrypted notebook [%s] has no valid identity", boxID)
}
} else if boxConf != nil && backup != nil {
return nil, fmt.Errorf("notebook [%s] has conflicting normal and encrypted identities", boxID)
} else if backup != nil {
boxCrypt = backup
}
payloadFound, payloadErr := hasEncryptedNotebookPayloadAtPath(boxDir)
if payloadErr != nil {
return nil, fmt.Errorf("inspect imported notebook [%s] failed: %w", boxID, payloadErr)
}
if boxCrypt == nil && payloadFound {
return nil, fmt.Errorf("imported notebook [%s] contains encrypted payload without identity", boxID)
}
if boxCrypt == nil {
continue
}
if err = validateBoxEncryption(boxCrypt); err != nil {
return nil, fmt.Errorf("invalid imported notebook identity [%s]: %w", boxID, err)
}
if filelock.IsExist(filepath.Join(util.DataDir, boxID)) && IsEncryptedBox(boxID) {
return nil, fmt.Errorf("refuse to overwrite existing encrypted notebook [%s]", boxID)
}
encryptedBoxIDs = append(encryptedBoxIDs, boxID)
}
return encryptedBoxIDs, nil
}View on GitHub (pinned to 9f775e8a12)