siyuan-note/siyuan · error

user guide path is not a directory

Error message

user guide path is not a directory: %s

What it means

readUserGuideDirectory stats a user-guide directory before calling os.ReadDir. If the path exists but is a regular file (or other non-directory), it returns 'user guide path is not a directory: %s' instead of attempting ReadDir on a file. Callers getUserGuideAVJSONFiles and getAllUserGuideAVJSONFiles propagate the error while collecting attribute-view JSON files from user-guide notebooks.

Solutions

  1. Delete or rename the offending file at the path printed in the error so the user-guide directory can be created/read
  2. Reopen or re-sync the workspace so missing user-guide folders are regenerated
  3. If a custom workspace/data path was misconfigured, correct it to point at the actual data directory
  4. Check disk/filesystem state for partial sync or copy operations that replaced the directory with a file
Defensive patterns

Strategy: validation

Validate before calling

if info, err := os.Stat(dir); err == nil && !info.IsDir() {
    // skip guide scan: path exists but is not a directory
}

Type guard

func isDir(p string) bool { info, err := os.Stat(p); return err == nil && info.IsDir() }

Prevention

When it happens

Trigger: os.Stat(dir) succeeds but info.IsDir() is false — i.e. a path expected to be a guide directory (e.g. under data/ for a user-guide notebook ID) exists as a plain file. Happens in readUserGuideDirectory invoked via getUserGuideAVJSONFiles or getAllUserGuideAVJSONFiles.

Common situations: A file was created where the guide notebook's storage directory should be (e.g. a stray file named like the guide box ID or its storage subpath), a partially-removed/recreated guide notebook left a file placeholder, or a custom/conf path points to a file instead of a directory.

Related errors


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

Appendix: source

Thrown at kernel/model/mount.go:635

		avFiles, err := getUserGuideAVJSONFiles(boxID)
		if nil != err {
			return nil, err
		}
		ret = append(ret, avFiles...)
	}
	return
}

func readUserGuideDirectory(dir string) ([]os.DirEntry, error) {
	info, err := os.Stat(dir)
	if os.IsNotExist(err) {
		return nil, nil
	}
	if err != nil {
		return nil, err
	}
	if !info.IsDir() {
		return nil, fmt.Errorf("user guide path is not a directory: %s", dir)
	}
	return os.ReadDir(dir)
}

View on GitHub (pinned to 9f775e8a12)