siyuan-note/siyuan · error

exporting special files is not supported

Error message

exporting special files is not supported

What it means

copyExportResource's WalkDir rejects any directory entry that is neither a directory nor a regular file (devices, FIFOs, sockets, etc.) with 'exporting special files is not supported'. This prevents exporting OS special files that have no meaningful standalone representation in a zip.

Solutions

  1. Remove the special files from the exported folder before exporting
  2. Point the export at folders that contain only regular files
  3. Investigate the process creating FIFOs/sockets inside the workspace and move its runtime files elsewhere

Example fix

// before: folder contains a FIFO
mkfifo assets/pipe && model.ExportResources([]string{"assets"})
// after: keep runtime files out of assets
mkfifo /tmp/pipe && model.ExportResources([]string{"assets"})
Defensive patterns

Strategy: validation

Validate before calling

fi, err := os.Stat(path)
if err == nil && !fi.Mode().IsRegular() && !fi.IsDir() { return errors.New("special file cannot be exported") }

Type guard

func isRegularOrDir(path string) bool {
    info, err := os.Lstat(path)
    return err == nil && (info.IsDir() || info.Mode().IsRegular())
}

Try / catch

if _, err := model.ExportResources(paths); err != nil {
    // remove special files (FIFOs, sockets, devices) from the folder and retry
}

Prevention

When it happens

Trigger: ExportResources on a folder containing a FIFO, device node, or socket — typically created by services using the assets folder for IPC, or by unusual restores.

Common situations: Apps writing named pipes into watched asset folders; container volumes exposing device nodes; test fixtures with mkfifo artifacts.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/87571dde1e2ec54b. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/export.go:961

	}

	return filepath.WalkDir(source, func(current string, entry fs.DirEntry, walkErr error) error {
		if walkErr != nil {
			return walkErr
		}
		if entry.Type()&os.ModeSymlink != 0 {
			return errors.New("exporting symbolic links is not supported")
		}
		relativePath, relErr := filepath.Rel(source, current)
		if relErr != nil {
			return relErr
		}
		target := filepath.Join(destination, relativePath)
		if entry.IsDir() {
			return os.MkdirAll(target, 0755)
		}
		if !entry.Type().IsRegular() {
			return errors.New("exporting special files is not supported")
		}
		return copyExportFile(current, target)
	})
}

// copyExportFile 复制单个导出文件,并从加密资源容器恢复用户可见名称。
func copyExportFile(source, destination string) error {
	boxID := ExtractBoxIDFromAssetsPath(source)
	if boxID != "" && IsEncryptedBox(boxID) {
		diskName := filepath.Base(source)
		if originalName := LookupAssetOriginalName(boxID, diskName); originalName != "" {
			fileName := util.FilterFileName(filepath.Base(originalName))
			if fileName != "" && fileName != "." {
				destination = uniqueExportFilePath(filepath.Join(filepath.Dir(destination), fileName))
			}
		}
	}
	return copyAssetDecryptIfEncrypted(source, destination)

View on GitHub (pinned to 9f775e8a12)