{"record":{"id":"2ab8d5557d952793","repo":"siyuan-note/siyuan","slug":"read-vault-path-s-w","errorCode":null,"errorMessage":"read Vault path [%s]: %w","messagePattern":"read Vault path \\[(.+?)\\]: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/import_obsidian.go","lineNumber":623,"sourceCode":"\tsort.Slice(entries, func(i, j int) bool { return strings.ToLower(entries[i].Name()) < strings.ToLower(entries[j].Name()) })\n\tfor _, entry := range entries {\n\t\tif err = ctx.Err(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tname := entry.Name()\n\t\trel := path.Join(relDir, filepath.ToSlash(name))\n\t\tabs := filepath.Join(absDir, name)\n\t\tif strings.HasPrefix(name, \".\") {\n\t\t\tif relDir == \"\" && name == \".obsidian\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvault.Analysis.SkippedHiddenCount++\n\t\t\tcontinue\n\t\t}\n\t\tentryInfo, infoErr := entry.Info()\n\t\tif infoErr != nil {\n\t\t\tif entry.IsDir() || strings.EqualFold(filepath.Ext(name), \".md\") {\n\t\t\t\treturn fmt.Errorf(\"read Vault path [%s]: %w\", rel, infoErr)\n\t\t\t}\n\t\t\tvault.Analysis.Warnings = append(vault.Analysis.Warnings, rel)\n\t\t\tcontinue\n\t\t}\n\t\tif entry.Type()&os.ModeSymlink != 0 || entryInfo.Mode()&os.ModeSymlink != 0 || isObsidianResolvedLink(abs) {\n\t\t\tvault.Analysis.SkippedLinkCount++\n\t\t\tcontinue\n\t\t}\n\t\tif entryInfo.IsDir() {\n\t\t\tnestedConfig := filepath.Join(abs, \".obsidian\")\n\t\t\tif nestedInfo, nestedErr := os.Lstat(nestedConfig); nestedErr == nil {\n\t\t\t\tif nestedInfo.IsDir() || nestedInfo.Mode()&os.ModeSymlink != 0 || isObsidianResolvedLink(nestedConfig) {\n\t\t\t\t\tvault.Analysis.SkippedNestedVaultCount++\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err = scanObsidianVaultFiles(ctx, vault, rel, abs); err != nil {\n\t\t\t\treturn err","sourceCodeStart":605,"sourceCodeEnd":641,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/import_obsidian.go#L605-L641","documentation":"While walking the vault, `entry.Info()` failed for a path and the importer classified the path as essential (a directory, or a `.md` file), so it aborts with this error instead of silently skipping. Non-essential files whose metadata cannot be read are only recorded as analysis warnings. This surfaces filesystem-level problems that would otherwise corrupt the import inventory.","triggerScenarios":"During scanObsidianVaultFiles, entry.Info() returns an error for a directory entry or for a file whose extension is `.md` (case-insensitive), e.g. permission denied, entry vanished between ReadDir and Info, or long-path errors on Windows.","commonSituations":"A markdown file deleted or renamed by Obsidian/sync while import is running; permission changes on specific notes; cloud-sync placeholders whose metadata cannot be hydrated (e.g. OneDrive files-on-demand); Windows MAX_PATH overruns.","solutions":["Identify the path from the error message and check it exists with `ls -la <vault>/<rel>`","Fix permissions on that specific file or directory","Pause sync clients (OneDrive/Dropbox/iCloud) during import so files are not changing","Enable long-path support or shorten paths on Windows if MAX_PATH is the cause"],"exampleFix":"# before: file metadata unreadable\nls -la vault/notes.md   # permission denied\n\n# after\nchmod u+rw vault/notes.md","handlingStrategy":"try-catch","validationCode":"import fs from \"fs\"\ntry { fs.statSync(mdFilePath) } catch (e) { repairOrRemove(mdFilePath) }","typeGuard":null,"tryCatchPattern":"try {\n  await importVault(vaultRoot)\n} catch (e) {\n  if (String(e.message).includes(\"read Vault path\")) {\n    const rel = e.message.match(/\\[(.*?)\\]/)?.[1]\n    console.warn(`Metadata unreadable for ${rel}; check existence and permissions`)\n  }\n}","preventionTips":["Pause cloud sync (OneDrive files-on-demand, Dropbox, iCloud) during import","Do not edit/rename notes in Obsidian while importing","Keep note paths short on Windows to avoid MAX_PATH errors"],"tags":["go","filesystem","obsidian-import","metadata"],"backgroundTag":"file-read-failed","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}