siyuan-note/siyuan · error

This is not a valid Data archive. If the archive was exporte

Error message

This is not a valid Data archive. If the archive was exported from [Documents], please import it from [Documents]

What it means

Thrown by ImportData (language code 198) when the glob finds .sy files directly at the first nesting level inside the unzipped archive (matching */*.sy). This structure indicates the archive was exported from a single notebook or document (the Documents export path), not a full Data export. Data archives wrap everything under a single top-level data-root directory and do not have .sy files at this level. The error message guides the user to use the correct import path.

Source

Thrown at kernel/model/import.go:1131

	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
		}
		if d == nil {
			return nil

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Use the correct import path: import notebook/document .sy.zip archives through the notebook import menu, not the Data import menu.
  2. If you need to import as Data, re-export using Settings - Export - Export Data.
  3. Check the archive structure: Data exports have a single top-level directory containing notebooks; document exports have .sy files at a shallower level.
Defensive patterns

Strategy: validation

Validate before calling

// Check archive type before choosing import function
func isDataArchive(zipPath string) (bool, error) {
    tmpDir, err := os.MkdirTemp("", "sy-check-")
    if err != nil {
        return false, err
    }
    defer os.RemoveAll(tmpDir)
    if err := gulu.Zip.Unzip(zipPath, tmpDir); err != nil {
        return false, err
    }
    // Data archives have no .sy files at */*.sy level
    matches, _ := filepath.Glob(filepath.Join(tmpDir, "*/*.sy"))
    if len(matches) > 0 {
        return false, nil // looks like a document/notebook export
    }
    dirs, err := os.ReadDir(tmpDir)
    if err != nil || len(dirs) != 1 {
        return false, nil
    }
    return true, nil
}

// Usage:
isData, _ := isDataArchive(zipPath)
if !isData {
    return errors.New("use notebook/document import for this archive type")
}

Try / catch

err := model.ImportData(zipPath)
if err != nil {
    if err.Error() == Conf.Language(198) {
        // Wrong archive type — guide user to correct import menu
        util.PushMsg("This is a document archive. Use the notebook import menu instead.")
    }
}

Prevention

When it happens

Trigger: Calling ImportData with a zip that was exported via the Documents/notebook export function rather than the Data export function. The glob at import.go:1125 finds one or more .sy files matching the */*.sy pattern, triggering the check at import.go:1130-1132.

Common situations: User exports a notebook as .sy.zip, then tries to import it through the Data import menu instead of the notebook/document import. User confuses the two export formats. User receives a .zip from someone who exported from Documents, not Data.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/d83816e4d00bba6c. Report an issue: GitHub.