{"record":{"id":"e4668088f86451ea","repo":"siyuan-note/siyuan","slug":"currently-available-space-is-s-at-least-s-i","errorCode":null,"errorMessage":"Currently available space is [%s], at least [%s] is required to perform this operation","messagePattern":"Currently available space is \\[(.+?)\\], at least \\[(.+?)\\] is required to perform this operation","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/export.go","lineNumber":661,"sourceCode":"\nfunc ExportDataInFolder(exportFolder string) (name string, err error) {\n\tutil.PushEndlessProgress(Conf.Language(65))\n\tdefer util.ClearPushProgress(100)\n\n\tdata := filepath.Join(util.WorkspaceDir, \"data\")\n\tif util.ContainerStd == util.Container {\n\t\t// 桌面端检查磁盘可用空间\n\n\t\tdataSize, sizeErr := util.SizeOfDirectory(data)\n\t\tif sizeErr != nil {\n\t\t\tlogging.LogErrorf(\"get size of data dir [%s] failed: %s\", data, sizeErr)\n\t\t\terr = sizeErr\n\t\t\treturn\n\t\t}\n\n\t\t_, _, tempExportFree := util.GetDiskUsage(util.TempDir)\n\t\tif int64(tempExportFree) < dataSize*2 { // 压缩 zip 文件时需要 data 的两倍空间\n\t\t\terr = fmt.Errorf(Conf.Language(242), humanize.BytesCustomCeil(tempExportFree, 2), humanize.BytesCustomCeil(uint64(dataSize)*2, 2))\n\t\t\treturn\n\t\t}\n\n\t\t_, _, targetExportFree := util.GetDiskUsage(exportFolder)\n\t\tif int64(targetExportFree) < dataSize { // 复制 zip 最多需要 data 一样的空间\n\t\t\terr = fmt.Errorf(Conf.Language(242), humanize.BytesCustomCeil(targetExportFree, 2), humanize.BytesCustomCeil(uint64(dataSize), 2))\n\t\t\treturn\n\t\t}\n\t}\n\n\tzipPath, err := ExportData()\n\tif err != nil {\n\t\treturn\n\t}\n\tname = filepath.Base(zipPath)\n\tname, err = url.PathUnescape(name)\n\tif err != nil {\n\t\tlogging.LogErrorf(\"url unescape [%s] failed: %s\", name, err)","sourceCodeStart":643,"sourceCodeEnd":679,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/export.go#L643-L679","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Free space on the volume containing the temp dir (or move the SiYuan workspace/temp dir to a larger volume via --workspace / SIYUAN_TEMPDIR).","Clean up old export zips in the temp/export folder.","Reduce workspace size by archiving/removing unused assets before exporting.","Point TMPDIR / the kernel temp dir at a disk with at least 2x the data-directory size free."],"exampleFix":"// launch kernel with a temp dir on a larger volume to avoid the 2x cap\nsiyuan-kernel --workspace /data/siyuan --tempdir /bigdisk/siyuan-tmp","handlingStrategy":"validation","validationCode":"// Pre-check temp volume free space >= 2x data size before exporting\nimport (\"github.com/dustin/go-humanize\")\ndataSize, _ := util.SizeOfDirectory(filepath.Join(util.WorkspaceDir, \"data\"))\n_, _, tempFree := util.GetDiskUsage(util.TempDir)\nif int64(tempFree) < dataSize*2 {\n    return fmt.Errorf(\"need %s free on temp volume, have %s\",\n        humanize.BytesCustomCeil(uint64(dataSize)*2, 2),\n        humanize.BytesCustomCeil(uint64(tempFree), 2))\n}","typeGuard":null,"tryCatchPattern":"if _, err := model.ExportData(); err != nil {\n    if strings.Contains(err.Error(), Conf.Language(242)[:20]) { // 'Currently available space'\n        // advise user to free temp-disk space or move the temp dir\n    }\n}","preventionTips":["Keep at least 2x the data-directory size free on the temp volume.","Point SIYUAN_TEMPDIR at a large disk for big workspaces.","Clean old export zips from temp/export regularly."],"tags":["disk-space","export","data-export","desktop"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}