{"record":{"id":"117aeeea78f1c356","repo":"siyuan-note/siyuan","slug":"conf-language-14-copy-docx-failed-s","errorCode":null,"errorMessage":"Conf.Language(14) (copy docx failed: %s)","messagePattern":"Conf\\.Language\\(14\\) \\(copy docx failed: (.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/export.go","lineNumber":1169,"sourceCode":"\t\t\targs = append(args, \"--reference-doc\", pandocRuntime.TemplatePath)\n\t\t}\n\n\t\tpandoc := exec.Command(pandocRuntime.BinPath, args...)\n\t\tgulu.CmdAttr(pandoc)\n\t\tpandoc.Stdin = bytes.NewBufferString(content)\n\t\toutput, pandocErr := pandoc.CombinedOutput()\n\t\tif pandocErr != nil {\n\t\t\targStr := strings.Join(args, \" \")\n\t\t\tmsg := gulu.DecodeCmdOutput(output)\n\t\t\tlogging.LogErrorf(\"export docx [%s] failed: %s\", argStr, msg)\n\t\t\treturn fmt.Errorf(Conf.Language(14), msg)\n\t\t}\n\n\t\tfullPath = filepath.Join(savePath, name+\".docx\")\n\t\tfullPath = util.GetUniqueFilename(fullPath)\n\t\tif copyErr := filelock.Copy(tmpDocxPath, fullPath); copyErr != nil {\n\t\t\tlogging.LogErrorf(\"export docx failed: %s\", copyErr)\n\t\t\treturn fmt.Errorf(Conf.Language(14), copyErr)\n\t\t}\n\n\t\tif tmpAssets := filepath.Join(tmpDir, \"assets\"); !removeAssets && gulu.File.IsDir(tmpAssets) {\n\t\t\tif copyErr := filelock.Copy(tmpAssets, filepath.Join(savePath, \"assets\")); copyErr != nil {\n\t\t\t\tlogging.LogErrorf(\"export docx failed: %s\", copyErr)\n\t\t\t\treturn fmt.Errorf(Conf.Language(14), copyErr)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tfullPath = \"\"\n\t}\n\treturn\n}\n\nfunc ExportMarkdownHTML(id, savePath string, docx, merge bool, mergeHeadingOptions ...MergeHeadingOptions) (name, dom string) {\n\tif err := prepareExportBlockAssets(id, merge); err != nil {","sourceCodeStart":1151,"sourceCodeEnd":1187,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/export.go#L1151-L1187","documentation":"After Pandoc produces a temporary .docx, ExportDocx copies it to the user-chosen save path via filelock.Copy. If that copy fails (target unwritable, path invalid, disk full, file locked), the localized 'Export failed: %s' template is filled with the copy error and returned, clearing fullPath.","triggerScenarios":"filelock.Copy(tmpDocxPath, fullPath) fails: savePath does not exist or is read-only, the target .docx is open/locked by another program (e.g. Word), or insufficient disk space.","commonSituations":"User exporting to a network drive that is offline; the destination .docx is currently open in Word causing a lock; exporting to a cloud-synced folder with sync locks; permission-denied on the target directory.","solutions":["Close the destination .docx in any open application and retry the export.","Verify the save directory exists and is writable; choose a different save path if needed.","Check free disk space on the target volume.","Check kernel logs for the exact copyErr to distinguish permission vs. lock vs. space issues."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// preflight: destination must be writable and not locked\nconst target = savePath + \"/\" + name + \".docx\";\nif (await fileExists(target)) await ensureNotOpenInEditor(target);","typeGuard":null,"tryCatchPattern":"try {\n  await exportDocx({id, savePath});\n} catch (e) {\n  if (String(e.msg).includes('copy')) {\n    suggestAlternateSavePath();\n  }\n}","preventionTips":["Close the destination .docx in Word/LibreOffice before re-exporting","Avoid exporting to offline network or cloud-sync-locked folders","Confirm disk space and write permissions on the save directory"],"tags":["file-copy","export","docx","filesystem"],"backgroundTag":"file-write-failed","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}