{"record":{"id":"87571dde1e2ec54b","repo":"siyuan-note/siyuan","slug":"exporting-special-files-is-not-supported","errorCode":null,"errorMessage":"exporting special files is not supported","messagePattern":"exporting special files is not supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/export.go","lineNumber":885,"sourceCode":"\t}\n\n\treturn filepath.WalkDir(source, func(current string, entry fs.DirEntry, walkErr error) error {\n\t\tif walkErr != nil {\n\t\t\treturn walkErr\n\t\t}\n\t\tif entry.Type()&os.ModeSymlink != 0 {\n\t\t\treturn errors.New(\"exporting symbolic links is not supported\")\n\t\t}\n\t\trelativePath, relErr := filepath.Rel(source, current)\n\t\tif relErr != nil {\n\t\t\treturn relErr\n\t\t}\n\t\ttarget := filepath.Join(destination, relativePath)\n\t\tif entry.IsDir() {\n\t\t\treturn os.MkdirAll(target, 0755)\n\t\t}\n\t\tif !entry.Type().IsRegular() {\n\t\t\treturn errors.New(\"exporting special files is not supported\")\n\t\t}\n\t\treturn copyExportFile(current, target)\n\t})\n}\n\n// copyExportFile 复制单个导出文件，并从加密资源容器恢复用户可见名称。\nfunc copyExportFile(source, destination string) error {\n\tboxID := ExtractBoxIDFromAssetsPath(source)\n\tif boxID != \"\" && IsEncryptedBox(boxID) {\n\t\tdiskName := filepath.Base(source)\n\t\tif originalName := LookupAssetOriginalName(boxID, diskName); originalName != \"\" {\n\t\t\tfileName := util.FilterFileName(filepath.Base(originalName))\n\t\t\tif fileName != \"\" && fileName != \".\" {\n\t\t\t\tdestination = uniqueExportFilePath(filepath.Join(filepath.Dir(destination), fileName))\n\t\t\t}\n\t\t}\n\t}\n\treturn copyAssetDecryptIfEncrypted(source, destination)","sourceCodeStart":867,"sourceCodeEnd":903,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/export.go#L867-L903","documentation":"Returned by copyExportResource's WalkDir callback for any directory entry that is not a directory, not a regular file, and not a symlink — i.e. a 'special' file: device node, named pipe (FIFO), socket, or other non-regular inode. SiYuan cannot meaningfully zip these, so it refuses. This fires only for descendants of a resource folder (the top-level non-dir case goes to copyExportFile directly).","triggerScenarios":"ExportResources on a folder that contains a FIFO/socket/device file — e.g. a Linux workspace where a process created a socket file inside the assets dir, or a user accidentally copied a device node. The WalkDir entry's Type() is not IsRegular() and not ModeSymlink.","commonSituations":"An application created a .sock or FIFO inside the workspace assets folder. A backup restore included special files. Containerized deployments leaking /dev entries into a mounted volume.","solutions":["Locate and remove the special file from the resource folder (find -type s, -type p, -type b, -type c).","Ensure no process creates sockets/FIFOs inside the SiYuan assets directory.","If the file is needed, move it outside the workspace and export only real assets.","Audit: find <resource_folder> \\( -type s -o -type p -o -type b -o -type c \\) -ls"],"exampleFix":"# before — a stray socket file blocks the export\nfind workspace/data/notebook/assets -type s -ls\n# after — remove special files before exporting\nfind workspace/data/notebook/assets \\( -type s -o -type p -o -type b -o -type c \\) -delete","handlingStrategy":"validation","validationCode":"// Walk each resource folder and reject if any descendant is a special file\nfor _, p := range resourcePaths {\n    full := filepath.Join(util.WorkspaceDir, p)\n    info, err := os.Lstat(full)\n    if err != nil || !info.IsDir() {\n        continue\n    }\n    _ = filepath.WalkDir(full, func(_ string, e fs.DirEntry, _ error) error {\n        if e != nil && !e.IsDir() && e.Type()&os.ModeSymlink == 0 && !e.Type().IsRegular() {\n            return fmt.Errorf(\"special file inside resource folder: %s\", e.Name())\n        }\n        return nil\n    })\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Audit folders with: find <folder> \\( -type s -o -type p -o -type b -o -type c \\) -ls.","Ensure no process creates sockets/FIFOs/device nodes inside the assets dir.","Remove special files before exporting."],"tags":["filesystem","special-files","export","resources","unsupported"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}