siyuan-note/siyuan · error

Export failed: %s

Error message

Export failed: %s

What it means

Raised in exportData when filelock.Copy fails copying the workspace data directory into the temp export folder. The raw copy error is wrapped with Conf.Language(14) ('Export failed: %s'). This is the heavy step that duplicates the entire data tree before zipping, so it fails on permission errors, disk-full mid-copy, or a locked/inaccessible source file.

Source

Thrown at kernel/model/export.go:727

	zipPath = "/export/" + url.PathEscape(filepath.Base(zipPath))
	return
}

func exportData(exportFolder string) (zipPath string, err error) {
	FlushTxQueue()

	logging.LogInfof("exporting data...")

	baseFolderName := "data-" + util.CurrentTimeSecondsStr()
	if err = os.MkdirAll(exportFolder, 0755); err != nil {
		logging.LogErrorf("create export temp folder failed: %s", err)
		return
	}

	data := filepath.Join(util.WorkspaceDir, "data")
	if err = filelock.Copy(data, exportFolder); err != nil {
		logging.LogErrorf("copy data dir from [%s] to [%s] failed: %s", data, baseFolderName, err)
		err = fmt.Errorf(Conf.Language(14), err.Error())
		return
	}

	zipPath = exportFolder + ".zip"
	zip, err := gulu.Zip.Create(zipPath)
	if err != nil {
		logging.LogErrorf("create export data zip [%s] failed: %s", exportFolder, err)
		return
	}

	zipCallback := func(filename string) {
		util.PushEndlessProgress(Conf.language(65) + " " + fmt.Sprintf(Conf.language(253), filename))
	}

	if err = zip.AddDirectory(baseFolderName, exportFolder, zipCallback); err != nil {
		logging.LogErrorf("create export data zip [%s] failed: %s", exportFolder, err)
		return
	}

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Check the kernel log for the underlying copy error message (the wrapped %s) — it names the file and the OS error.
  2. Close other programs (sync, antivirus, backup) that may lock files in the workspace data directory and retry.
  3. Run SiYuan as a user with full permissions on the workspace directory.
  4. Free more disk space — the pre-check can underestimate concurrent writes.
  5. Shorten very deep paths or move the workspace closer to the filesystem root on Windows.
Defensive patterns

Strategy: try-catch

Try / catch

if _, err := model.ExportData(); err != nil {
    if strings.HasPrefix(err.Error(), Conf.Language(14)[:13]) { // 'Export failed:'
        // inspect underlying cause in log (export.go:726), then retry after fixing perms/space
    }
}

Prevention

When it happens

Trigger: POST /api/export/exportData or exportDataInFolder where filelock.Copy(data, exportFolder) errors — file held open by another process (Windows), permission denied on a file inside data/, disk fills up mid-copy (the space check is heuristic and can underestimate), or the source tree contains a path too long on Windows.

Common situations: Antivirus or backup software locking files in the data dir on Windows. A sync operation writing concurrently. A corrupted file with wrong permissions. Disk space exhausted despite the pre-check (e.g. assets grew between check and copy).

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/2e6bccc6cb504021. Report an issue: GitHub.