siyuan-note/siyuan · error

create conf dir failed

Error message

create conf dir failed: %w

What it means

placeDocInSiblingOrder persists per-notebook custom sort order into <data>/<box>/.siyuan/sort.json. It wraps any os.MkdirAll failure of the .siyuan config directory with this message. This is a filesystem I/O failure, not a logical error — the sort cannot be saved.

Solutions

  1. Check filesystem permissions on <data>/<boxID>/ and ensure the kernel process user can create directories there
  2. Free disk space / resolve disk-quota exhaustion and retry
  3. Verify the notebook directory still exists under the data directory; if not, re-open the notebook
  4. Check for a read-only mount or disconnected network storage holding the workspace

Example fix

// inspect the wrapped cause before retrying
ls -ld ~/SiYuan/data/<boxID>
mkdir -p ~/SiYuan/data/<boxID>/.siyuan  # reproduce the EACCES/ENOSPC manually
Defensive patterns

Strategy: retry

Try / catch

err := placeDocInSiblingOrder(...)
if err != nil && strings.Contains(err.Error(), "create conf dir failed") {
    // inspect wrapped cause: errors.Unwrap, check disk/permissions, retry once
}

Prevention

When it happens

Trigger: os.MkdirAll(util.DataDir/<boxID>/.siyuan, 0755) fails while inserting a document into sibling custom order — e.g. data directory missing, disk full, permissions changed, path owned by another user, or the notebook directory was deleted concurrently.

Common situations: Read-only volume or network drive disconnected; running SiYuan under a different user than the data dir owner; antivirus blocking directory creation; disk quota exceeded.

Understand the failure class

Background: mkdir permission denied (EACCES): failed to create directory errors explained — this error's family across 32 libraries.

Related errors


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

Appendix: source

Thrown at kernel/model/file.go:3088

func (box *Box) addMaxSort(parentPath, id string) {
	if err := box.placeDocInSiblingOrder(parentPath, id, "", "after"); nil != err {
		logging.LogErrorf("append document sort failed: %s", err)
	}
}

func (box *Box) addMinSort(parentPath, id string) {
	if err := box.placeDocInSiblingOrder(parentPath, id, "", "before"); nil != err {
		logging.LogErrorf("prepend document sort failed: %s", err)
	}
}

func (box *Box) placeDocInSiblingOrder(parentPath, id, targetID, position string) error {
	fileTreeSortLock.Lock()
	confDir := filepath.Join(util.DataDir, box.ID, ".siyuan")
	if err := os.MkdirAll(confDir, 0755); nil != err {
		fileTreeSortLock.Unlock()
		return fmt.Errorf("create conf dir failed: %w", err)
	}
	confPath := filepath.Join(confDir, "sort.json")
	fullSortIDs, err := readSortConfMap(confPath)
	if nil != err {
		fileTreeSortLock.Unlock()
		return err
	}
	currentIDs, err := loadSiblingCustomOrder(box.ID, parentPath, fullSortIDs)
	if nil != err {
		fileTreeSortLock.Unlock()
		return err
	}
	orderedIDs := make([]string, 0, len(currentIDs)+1)
	for _, currentID := range currentIDs {
		if currentID != id {
			orderedIDs = append(orderedIDs, currentID)
		}
	}

View on GitHub (pinned to 9f775e8a12)