{"record":{"id":"11eb09e7f8661877","repo":"siyuan-note/siyuan","slug":"encrypted-document-in-ordinary-notebook-s","errorCode":null,"errorMessage":"encrypted document in ordinary notebook: %s","messagePattern":"encrypted document in ordinary notebook: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"kernel/model/asset_relink.go","lineNumber":164,"sourceCode":"\t\t\t\t}\n\t\t\t\tif strings.HasPrefix(entry.Name(), \".\") || entry.Name() == \"storage\" {\n\t\t\t\t\treturn filepath.SkipDir\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif !strings.HasSuffix(entry.Name(), \".sy\") {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif err := p.observe(absPath); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tp.reportProgress(absPath)\n\t\t\tdata, readErr := filelock.ReadFile(absPath)\n\t\t\tif readErr != nil {\n\t\t\t\treturn readErr\n\t\t\t}\n\t\t\tif util.IsCiphertext(data) {\n\t\t\t\treturn fmt.Errorf(\"encrypted document in ordinary notebook: %s\", absPath)\n\t\t\t}\n\t\t\tif readErr = treenode.CheckSpecJSON(data); readErr != nil {\n\t\t\t\treturn readErr\n\t\t\t}\n\t\t\tif !json.Valid(data) {\n\t\t\t\treturn fmt.Errorf(\"invalid document JSON: %s\", absPath)\n\t\t\t}\n\t\t\tvar header struct {\n\t\t\t\tID         string `json:\"ID\"`\n\t\t\t\tProperties struct {\n\t\t\t\t\tTitle string `json:\"title\"`\n\t\t\t\t} `json:\"Properties\"`\n\t\t\t}\n\t\t\tif readErr = json.Unmarshal(data, &header); readErr != nil {\n\t\t\t\treturn readErr\n\t\t\t}\n\t\t\ttitles[header.ID] = header.Properties.Title\n\t\t\tif !p.mayContainReferences(data) && !bytes.Contains(data, []byte(\"NodeAttributeView\")) {","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/asset_relink.go#L146-L182","documentation":"While scanning an ordinary (non-encrypted) notebook, the walker reads a .sy document and detects ciphertext via util.IsCiphertext(data). Encrypted documents are only valid inside encrypted notebooks, so the relink scan aborts rather than parsing data it cannot authenticate or correctly index.","triggerScenarios":"A .sy file inside a regular notebook contains encrypted content — typically because the document was moved/copied out of an encrypted notebook, the notebook was switched from encrypted to ordinary, or an encryption envelope was applied but the notebook is not registered as encrypted; the scan calls filelock.ReadFile then util.IsCiphertext and fails with the absolute path.","commonSituations":"Copying documents between an encrypted notebook and a normal notebook via the filesystem instead of the app; restoring a partial backup that mixed encrypted and plain documents; misconfigured workspace where notebook metadata marking encryption was lost.","solutions":["Move the encrypted document back into its encrypted notebook (via the app's move feature, not manual file copies).","Unlock/decrypt the document in the encrypted notebook using its key, then relocate the decrypted version if a plain copy is needed.","Restore notebook metadata so the notebook is correctly recognized as encrypted if that is its true state.","Do not attempt to hand-edit or strip the ciphertext — that breaks authentication and recovery guarantees."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"_, err := model.RelinkAsset(old, new, dry)\nif err != nil && strings.HasPrefix(err.Error(), \"encrypted document in ordinary notebook\") {\n    // move the document back to its encrypted notebook or decrypt via the app\n}","preventionTips":["Move documents between notebooks only via the app, not the filesystem","Do not toggle a notebook between encrypted and ordinary while documents remain encrypted","Keep notebook metadata intact in backups"],"tags":["encryption","asset-relink","document-scan"],"backgroundTag":"incompatible-source-type","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"}