siyuan-note/siyuan · error

This archive contains notebook data. Please import it from [

Error message

This archive contains notebook data. Please import it from [Document Tree - More - Import Notebook]

What it means

Thrown by model.ImportSY (kernel/model/import.go:141) when the supplied .sy.zip is actually a multi-notebook bundle export. isSYNotebookBundle detects the batch format by looking for a '.siyuan/notebooks.json' manifest entry anywhere in the zip (see kernel/model/notebook_bundle.go:64). Bundle archives are only understood by the notebook-import path, so the document-import endpoint refuses them up front with the localized Language(373) message pointing at Document Tree - More - Import Notebook.

Source

Thrown at kernel/model/import.go:141

				n.Tokens = bytes.ReplaceAll(n.Tokens, []byte("|"), []byte("\\|"))
				n.Tokens = bytes.ReplaceAll(n.Tokens, []byte("\\<br /\\>"), []byte("<br />"))
			}
		case ast.NodeInlineMath:
			withMath = true
		case ast.NodeLinkDest:
			dest := n.TokensStr()
			if strings.HasPrefix(dest, "data:image") && strings.Contains(dest, ";base64,") {
				processBase64Img(n, dest, assetDirPath, boxID)
			}
		}
		return ast.WalkContinue
	})
	return
}

func ImportSY(zipPath, boxID, toPath string) (err error) {
	if isSYNotebookBundle(zipPath) {
		return errors.New(Conf.Language(373))
	}
	_, err = importSY(zipPath, boxID, toPath, false, false)
	return
}

func ImportSYNotebook(zipPath string) (boxID string, err error) {
	return importSY(zipPath, "", "/", true, false)
}

var ErrSYTargetNotebookRequired = errors.New("target notebook required")

func ImportSYAuto(zipPath, boxID, toPath string) (createdBoxID string, notebook bool, err error) {
	createdBoxID, err = importSY(zipPath, boxID, toPath, false, true)
	notebook = err == nil && createdBoxID != boxID
	return
}

func isSYNotebookExport(hasBoxConf, hasBoxDocMeta bool) bool {

View on GitHub (pinned to afa823b6b4)

Solutions

  1. Import the file via the notebook path instead: POST /api/import/importSYNotebook, which first tries model.ImportSYNotebookBundle and handles bundles (UI: Document Tree - More - Import Notebook)
  2. Or call POST /api/import/importSYAuto, which auto-dispatches bundle, notebook, and document archives
  3. If you truly need a document-level import, re-export just the document (not the whole notebook) as .sy.zip from the source instance

Example fix

// before
err := model.ImportSY(zipPath, boxID, toPath) // fails: bundle rejected with Language(373)

// after
if ids, bundle, bundleErr := model.ImportSYNotebookBundle(zipPath); bundle {
    // ids = created notebook IDs; bundleErr handled separately
} else if bundleErr == nil {
    boxID, err := model.ImportSYNotebook(zipPath)
}
Defensive patterns

Strategy: validation

Validate before calling

func isNotebookBundle(zipPath string) bool {
    r, err := zip.OpenReader(zipPath)
    if err != nil {
        return false
    }
    defer r.Close()
    for _, f := range r.File {
        if strings.HasSuffix(f.Name, "/.siyuan/notebooks.json") {
            return true
        }
    }
    return false
}

if isNotebookBundle(zipPath) {
    // route to /api/import/importSYNotebook instead of importSY
}

Try / catch

if err := model.ImportSY(zipPath, boxID, toPath); err != nil {
    if err.Error() == model.Conf.Language(373) {
        // archive is notebook data: re-dispatch via model.ImportSYNotebook / ImportSYNotebookBundle
        return
    }
    // other failures: surface to user
}

Prevention

When it happens

Trigger: POST /api/import/importSY (or /api/import/continueImportSY, or a direct model.ImportSY call) with an archive produced by batch notebook export, i.e. any zip containing an entry ending in '/.siyuan/notebooks.json'. The check runs before unzipping, so the error is immediate.

Common situations: User selects several notebooks and exports them as one archive from the document tree, then feeds that file to the doc-level '.sy.zip' import (wrong menu item). Automation scripts or plugins that always call importSY regardless of archive kind. Dragging a bundle onto the doc tree in an older build that lacked auto-detection.

Related errors


AI-assisted analysis of siyuan-note/siyuan@afa823b6b4 (2026-08-18). Data as JSON: /api/errors/4379a20324952f36. Report an issue: GitHub.