siyuan-note/siyuan · error

Conf.Language(198)

Error message

Conf.Language(198)

What it means

ImportData requires the zip to contain exactly one top-level directory (the data folder). If the glob */*.sy finds document files directly under a first-level subdirectory — i.e. notebooks were not nested under a single data root — the layout is rejected with localized message 198 (Conf.Language(198)), which tells the user the data.zip structure is wrong.

Source

Thrown at kernel/model/import.go:1289

	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 8641553a1f)

Solutions

  1. Repack the zip so all notebook folders live under exactly one root directory (the data folder content)
  2. Use SiYuan's own 'Export data.zip' / settings-based export instead of manually zipping
  3. Remove stray .sy files at data/<name>/*.sy level and re-zip
  4. Verify structure: unzip should yield a single directory containing notebook-ID folders
Defensive patterns

Strategy: validation

Validate before calling

// Verify zip layout: no .sy files at the second level
files, _ := filepath.Glob(filepath.Join(extractRoot, "*/*.sy"))
if len(files) > 0 {
  return errors.New("zip layout invalid: .sy files not nested under data root")
}

Try / catch

if err := ImportData(zipPath); err != nil {
  if err.Error() == langMsg198 {
    // repack the zip with a single wrapping data root and retry
  }
}

Prevention

When it happens

Trigger: ImportData with a zip whose structure is data/<notebookID>/*.sy instead of data/<single-root>/<notebookID>/*.sy, or a zip of a single notebook's files rather than a full data folder.

Common situations: Zipping notebook folders directly instead of the whole data directory; using 'Export data.zip' incorrectly; hand-built zips missing the wrapping root folder.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11). Data as JSON: /api/errors/7eefbeb3b9521d6a. Report an issue: GitHub.