siyuan-note/siyuan · error

Conf.Language(242) (insufficient disk space: %s free, %s req

Error message

Conf.Language(242) (insufficient disk space: %s free, %s required)

What it means

ExportDataInFolder checks free disk space in the temp directory before zipping: the export needs roughly 2x the data size (zip compression). If temp free space < dataSize*2 it returns Conf.Language(242): 'Currently available space is [%s], at least [%s] is required to perform this operation'.

Source

Thrown at kernel/model/export.go:720

		return
	}
	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 8641553a1f)

Solutions

  1. Free disk space on the volume holding the temp directory
  2. Point the temp directory (TMPDIR/TMP env or workspace temp) to a larger volume
  3. Export a smaller data range or clean up workspace data (trash/history) first

Example fix

// before
export data to folder with 1GB data but only 1.5GB temp free
// after
free temp volume or set TMPDIR to a drive with >2GB free, then retry
Defensive patterns

Strategy: validation

Validate before calling

const dataBytes = await getWorkspaceDataSize();
const tempFree = (await getDiskUsage(tempDir)).free;
if (tempFree < dataBytes * 2) throw new Error(`Temp volume needs >= ${formatBytes(dataBytes*2)} free`);

Try / catch

try {
  await exportDataInFolder(path);
} catch (e) {
  if (String(e.msg).includes("available space")) showHint("Free temp-disk space and retry");
}

Prevention

When it happens

Trigger: Calling the export-data-to-folder API when util.TempDir has less than twice the workspace data size free.

Common situations: Exporting a large workspace to a nearly-full system disk; temp dir on a small partition (e.g. /tmp on a constrained volume); Windows drive C nearly full.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11). Data as JSON: /api/errors/81d981c2203518d8. Report an issue: GitHub.