{"record":{"id":"7144ed9329d36d15","repo":"siyuan-note/siyuan","slug":"conf-language-242","errorCode":null,"errorMessage":"Conf.Language(242)","messagePattern":"Conf\\.Language\\(242\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/export.go","lineNumber":723,"sourceCode":"\t\treturn\n\t}\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":705,"sourceCodeEnd":741,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/export.go#L705-L741","documentation":"SiYuan's ExportDataInFolder checks free disk space before exporting the whole workspace data as a zip. If the temp directory has less than 2x the data size free (needed for zipping), it fails with the localized message 242 (insufficient disk space), embedding current free space and required space via humanize.BytesCustomCeil.","triggerScenarios":"Calling the data-export API with an export folder when util.TempDir free space < 2 * workspace data size. Happens on nearly-full disks or very large workspaces.","commonSituations":"Exporting a multi-GB workspace to a laptop disk with only a few GB free; export drive/temp on a small partition; snapshots/logs filling the temp volume.","solutions":["Free disk space on the temp volume (set TEMP/TMP to a larger volume or clean util.TempDir)","Reduce workspace size (purge assets/history) before export","Export to a location where temp and target both have >= 2x data size free"],"exampleFix":"// before (fails when temp free < 2x data)\nerr = fmt.Errorf(Conf.Language(242), humanize.BytesCustomCeil(tempExportFree, 2), humanize.BytesCustomCeil(uint64(dataSize)*2, 2))\n// after (caller): point temp at a volume with sufficient space\nos.Setenv(\"TMPDIR\", \"/mnt/bigdisk/tmp\") // ensure >= 2 * dataSize free","handlingStrategy":"validation","validationCode":"_, _, free := util.GetDiskUsage(util.TempDir)\nif int64(free) < 2*dataSize { return fmt.Errorf(\"need %d bytes free in temp\", 2*dataSize) }","typeGuard":null,"tryCatchPattern":"if err := model.ExportDataInFolder(folder); err != nil {\n    // localized 242: check free space message and free disk space before retry\n}","preventionTips":["Monitor free space on the temp volume (keep > 2x workspace size)","Point TMPDIR/TEMP at a large volume for big workspaces","Clean util.TempDir regularly"],"tags":["disk-space","export","filesystem"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}