{"record":{"id":"d056ee7eaf9489b9","repo":"siyuan-note/siyuan","slug":"346","errorCode":"346","errorMessage":"Markdown [%s] changed after analysis: %w","messagePattern":"Markdown \\[(.+?)\\] changed after analysis: %w","errorType":"error_code","errorClass":"obsidianUserError","httpStatus":null,"severity":"error","filePath":"kernel/model/import_obsidian.go","lineNumber":1845,"sourceCode":"\t}\n\tif len(vault.Assets) != len(fresh.Assets) {\n\t\treturn newObsidianUserError(349, \"\", errors.New(\"the attachment file list changed after analysis\"))\n\t}\n\tfor key := range vault.Assets {\n\t\tif fresh.Assets[key] == nil {\n\t\t\treturn newObsidianUserError(349, \"\", errors.New(\"the attachment file list changed after analysis\"))\n\t\t}\n\t}\n\tfor _, doc := range vault.Docs {\n\t\tif doc.Synthetic {\n\t\t\tcontinue\n\t\t}\n\t\tif err := ctx.Err(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := validateObsidianSourceMetadata(doc.Source); err != nil {\n\t\t\treturn newObsidianUserError(346, doc.Source.RelPath,\n\t\t\t\tfmt.Errorf(\"Markdown [%s] changed after analysis: %w\", doc.Source.RelPath, err))\n\t\t}\n\t}\n\tfor _, asset := range vault.ImportAssets {\n\t\tif err := ctx.Err(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := validateObsidianSourceMetadata(asset.Source); err != nil {\n\t\t\treturn newObsidianUserError(346, asset.Source.RelPath,\n\t\t\t\tfmt.Errorf(\"attachment [%s] changed after analysis: %w\", asset.Source.RelPath, err))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc validateObsidianSourceMetadata(file *obsidianSourceFile) error {\n\tinfo, err := os.Stat(file.AbsPath)\n\tif err != nil {\n\t\treturn err","sourceCodeStart":1827,"sourceCodeEnd":1863,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/import_obsidian.go#L1827-L1863","documentation":"Per-file markdown drift in revalidateObsidianVault: validateObsidianSourceMetadata(doc.Source) failed because os.Stat now reports a Size or ModTime different from the snapshot taken at scan time. Reported with code 346 ('File [%s] changed after analysis; analyze the Vault again'). This is a finer-grained version of 788/789: even if the file set is stable, content edits are caught by size/mtime.","triggerScenarios":"A markdown file that existed at both times was edited in place: its size and/or mtime changed. Common when the user keeps taking notes in Obsidian after analysis, or a sync client rewrote the file body without adding/removing it.","commonSituations":"Active note-taking during import; cloud sync pushing content updates; Git pull updating file bodies; an editor's auto-save touching mtime without a real edit; filesystem mtime resolution causing spurious differences on some network FS.","solutions":["Stop editing the vault, re-run StartObsidianVaultAnalysis, then immediately import.","Pause sync/Git for the vault during the analyse→import window.","If mtime drift is spurious (network FS), copy the vault to a local FS and import from there.","Disable auto-save or touch-on-open editors for the vault until import completes."],"exampleFix":"// before: edit a note after analysis -> size/mtime differ -> 346\n//   echo 'new line' >> notes/daily.md  (after analysis)\n\n// after: finish edits, re-analyse, then import without further edits\nStartObsidianVaultAnalysis(vault)\nStartObsidianVaultImport(taskID, nb)","handlingStrategy":"validation","validationCode":"// Verify no markdown size/mtime drift since analysis.\nfunc markdownUnchanged(vault string, snap map[string]fileMeta) error { /* compare os.Stat vs snap */ }","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Stop note-taking and sync during the analyse→import window.","Use a local copy on a stable FS for network-vault imports.","Disable auto-save/touch-on-open editors for the vault."],"tags":["obsidian-import","revalidation","file-drift","mtime","concurrency"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}