siyuan-note/siyuan · error

Currently available space is [%s], at least [%s] is required

Error message

Currently available space is [%s], at least [%s] is required to perform this operation

What it means

Raised in ExportDataInFolder (desktop/ContainerStd only) when the free space on the volume hosting util.TempDir is less than 2x the size of the workspace data directory. The factor of 2 is intentional: zipping requires room for both the copied data tree and the in-progress zip archive. Conf.Language(242) formats the actual free bytes and required bytes via humanize.BytesCustomCeil.

Source

Thrown at kernel/model/export.go:661

func ExportDataInFolder(exportFolder string) (name string, err error) {
	util.PushEndlessProgress(Conf.Language(65))
	defer util.ClearPushProgress(100)

	data := filepath.Join(util.WorkspaceDir, "data")
	if util.ContainerStd == util.Container {
		// 桌面端检查磁盘可用空间

		dataSize, sizeErr := util.SizeOfDirectory(data)
		if sizeErr != nil {
			logging.LogErrorf("get size of data dir [%s] failed: %s", data, sizeErr)
			err = sizeErr
			return
		}

		_, _, tempExportFree := util.GetDiskUsage(util.TempDir)
		if int64(tempExportFree) < dataSize*2 { // 压缩 zip 文件时需要 data 的两倍空间
			err = fmt.Errorf(Conf.Language(242), humanize.BytesCustomCeil(tempExportFree, 2), humanize.BytesCustomCeil(uint64(dataSize)*2, 2))
			return
		}

		_, _, targetExportFree := util.GetDiskUsage(exportFolder)
		if int64(targetExportFree) < dataSize { // 复制 zip 最多需要 data 一样的空间
			err = fmt.Errorf(Conf.Language(242), humanize.BytesCustomCeil(targetExportFree, 2), humanize.BytesCustomCeil(uint64(dataSize), 2))
			return
		}
	}

	zipPath, err := ExportData()
	if err != nil {
		return
	}
	name = filepath.Base(zipPath)
	name, err = url.PathUnescape(name)
	if err != nil {
		logging.LogErrorf("url unescape [%s] failed: %s", name, err)

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Free space on the volume containing the temp dir (or move the SiYuan workspace/temp dir to a larger volume via --workspace / SIYUAN_TEMPDIR).
  2. Clean up old export zips in the temp/export folder.
  3. Reduce workspace size by archiving/removing unused assets before exporting.
  4. Point TMPDIR / the kernel temp dir at a disk with at least 2x the data-directory size free.

Example fix

// launch kernel with a temp dir on a larger volume to avoid the 2x cap
siyuan-kernel --workspace /data/siyuan --tempdir /bigdisk/siyuan-tmp
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check temp volume free space >= 2x data size before exporting
import ("github.com/dustin/go-humanize")
dataSize, _ := util.SizeOfDirectory(filepath.Join(util.WorkspaceDir, "data"))
_, _, tempFree := util.GetDiskUsage(util.TempDir)
if int64(tempFree) < dataSize*2 {
    return fmt.Errorf("need %s free on temp volume, have %s",
        humanize.BytesCustomCeil(uint64(dataSize)*2, 2),
        humanize.BytesCustomCeil(uint64(tempFree), 2))
}

Try / catch

if _, err := model.ExportData(); err != nil {
    if strings.Contains(err.Error(), Conf.Language(242)[:20]) { // 'Currently available space'
        // advise user to free temp-disk space or move the temp dir
    }
}

Prevention

When it happens

Trigger: Invoking POST /api/export/exportDataInFolder (or the UI's 'Export Data' to a chosen folder) on a desktop build where the system/temp volume is nearly full. Common when the workspace data is large (many GB of assets) and the temp dir sits on a small partition.

Common situations: Temp directory on a small root partition or a nearly-full disk. Large notebook with many embedded images/videos. User exporting data repeatedly without cleaning old exports.

Related errors


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