siyuan-note/siyuan · error

check data.zip failed

Error message

check data.zip failed

What it means

ImportData checks the unzipped archive layout: it globs for '*/*.sy' and reads the top-level directory. If either the Glob call or os.ReadDir fails at the OS level (unexpected I/O error, not a layout problem), the generic error 'check data.zip failed' is returned. The real cause is logged to the kernel log.

Solutions

  1. Check the kernel log for the line 'check data.zip failed: <cause>' to see the underlying OS error
  2. Fix permissions on the directory containing the zip and its extraction folder
  3. Exclude the workspace from antivirus/cleanup tools that delete temp directories
  4. Retry the import; if it persists, move the zip to a short local path (e.g. C:\tmp or /tmp) and retry
Defensive patterns

Strategy: try-catch

Validate before calling

// Caller-side: ensure the extraction location is readable before import
if _, err := os.Stat(filepath.Dir(zipPath)); err != nil {
    return fmt.Errorf("import source dir unreadable: %w", err)
}

Try / catch

err := model.ImportData(zipPath)
if err != nil && err.Error() == "check data.zip failed" {
    // read kernel log for the underlying os error, fix permissions/disk, retry once
    log.Printf("import layout check failed; see kernel log for cause")
}

Prevention

When it happens

Trigger: ImportData when filepath.Glob returns a non-nil error (rare, e.g. malformed pattern path) or os.ReadDir on the unzip directory fails (permission error, unzip directory removed concurrently, path too long).

Common situations: Running the kernel without read permission on the extraction directory; antivirus or cleanup tools deleting the temp unzip dir mid-import; excessively long paths on Windows.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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

Appendix: source

Thrown at kernel/model/import.go:1411

	lockSync()
	defer unlockSync()

	logging.LogInfof("import data from [%s]", zipPath)
	baseName := filepath.Base(zipPath)
	ext := filepath.Ext(baseName)
	baseName = strings.TrimSuffix(baseName, ext)
	unzipPath := filepath.Join(filepath.Dir(zipPath), baseName)
	err = gulu.Zip.Unzip(zipPath, unzipPath)
	if err != nil {
		return
	}
	defer os.RemoveAll(unzipPath)

	files, err := filepath.Glob(filepath.Join(unzipPath, "*/*.sy"))
	if err != nil {
		logging.LogErrorf("check data.zip failed: %s", err)
		return errors.New("check data.zip failed")
	}
	if 0 < len(files) {
		return errors.New(Conf.Language(198))
	}
	dirs, err := os.ReadDir(unzipPath)
	if err != nil {
		logging.LogErrorf("check data.zip failed: %s", err)
		return errors.New("check data.zip failed")
	}
	if 1 != len(dirs) {
		return errors.New(Conf.Language(198))
	}

	tmpDataPath := filepath.Join(unzipPath, dirs[0].Name())
	tmpDataEmojisPath := filepath.Join(tmpDataPath, "emojis")
	filelock.Walk(tmpDataEmojisPath, func(path string, d fs.DirEntry, err error) error {
		if err != nil {
			return err

View on GitHub (pinned to 9f775e8a12)