siyuan-note/siyuan · error

Obsidian Vault is unreadable

Error message

Obsidian Vault is unreadable

What it means

`errObsidianVaultUnreadable` is the generic sentinel for "the given Obsidian Vault path cannot be used". It is wrapped with `%w` for detail (empty path, unreadable config dir) and is translated to i18n key 336 for the user via `obsidianVaultErrorLanguage`. It groups all cases where the Vault root itself could not be validated/read.

Solutions

  1. Enter/re-pass a real, non-empty path to the Vault root directory (the folder containing `.obsidian`)
  2. Check the OS permissions on the Vault directory and `.obsidian` folder and grant read access
  3. Remount the drive/share hosting the Vault and retry

Example fix

// before
importObsidianVault("") // wrapped: errObsidianVaultUnreadable: path is empty
// after
importObsidianVault("/home/user/Documents/MyVault") // real vault root containing .obsidian/
Defensive patterns

Strategy: validation

Validate before calling

const stat = await fs.stat(vaultPath).catch(() => null);
if (!stat || !stat.isDirectory()) {
  throw new Error("Vault path must be an existing readable directory");
}
await fs.access(path.join(vaultPath, ".obsidian"));

Type guard

function isReadableVaultPath(p: string): boolean {
  return typeof p === "string" && p.trim().length > 0;
}

Try / catch

try {
  await api.importObsidianVault(vaultPath);
} catch (e) {
  if (isVaultUnreadable(e)) {
    // surface i18n key 336 guidance: provide a real, accessible vault path
  }
}

Prevention

When it happens

Trigger: Calling `ImportObsidianVault`/validation with an empty or whitespace-only `localPath` (`fmt.Errorf("%w: path is empty", ...)`), or when the `.obsidian` config directory stat fails with a non-not-exist error (read permission/IO error), both wrapped with this sentinel.

Common situations: User submitted an empty vault field in the import dialog; the vault lives on an unavailable/unmounted drive or a network share that denies access; antivirus or OS permissions block reading `.obsidian`.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/2a28a1e7003272ae. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/import_obsidian.go:230

}

func (err *obsidianUserError) Error() string {
	return err.Cause.Error()
}

func (err *obsidianUserError) Unwrap() error {
	return err.Cause
}

func newObsidianUserError(detailLanguage int, relPath string, cause error) error {
	return &obsidianUserError{DetailLanguage: detailLanguage, RelPath: relPath, Cause: cause}
}

var (
	obsidianTasksMu                 sync.Mutex
	obsidianTasks                   = map[string]*obsidianTask{}
	obsidianActive                  string
	errObsidianVaultUnreadable      = errors.New("Obsidian Vault is unreadable")
	errObsidianVaultNotDirectory    = errors.New("Obsidian Vault path is not a directory")
	errObsidianVaultUnsafePath      = errors.New("Obsidian Vault path is unsafe")
	errObsidianVaultConfigMissing   = errors.New("Obsidian Vault config directory is missing")
	errObsidianVaultMarkdownMissing = errors.New("Obsidian Vault has no readable Markdown")
	errObsidianSourceChanged        = errors.New("Obsidian source file changed")

	obsidianBlockIDPattern  = regexp.MustCompile(`(?m)(?:^|[ \t])\^([A-Za-z0-9-]+)[ \t]*$`)
	obsidianQuotePattern    = regexp.MustCompile(`^((?:[ \t]*>[ \t]?)+)(.*)$`)
	obsidianListItemPattern = regexp.MustCompile(`^([ \t]*(?:[-+*]|\d+[.)])[ \t]+)(.*)$`)
	obsidianFootnotePattern = regexp.MustCompile(`(?m)\[\^[^\]\r\n]+\]`)
)

func StartObsidianVaultAnalysis(localPath string) (*ObsidianVaultTask, error) {
	var replacedTaskID string
	obsidianTasksMu.Lock()
	if obsidianActive != "" {
		if active := obsidianTasks[obsidianActive]; active != nil && !isObsidianTerminalState(active.State) {
			if !isObsidianPreImportState(active.State) {

View on GitHub (pinned to 9f775e8a12)