{"record":{"id":"5b315a60076bf2f5","repo":"siyuan-note/siyuan","slug":"conf-language-373","errorCode":null,"errorMessage":"Conf.Language(373)","messagePattern":"Conf\\.Language\\(373\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/import.go","lineNumber":158,"sourceCode":"\t\t\t\tn.Tokens = bytes.ReplaceAll(n.Tokens, []byte(\"|\"), []byte(\"\\\\|\"))\n\t\t\t\tn.Tokens = bytes.ReplaceAll(n.Tokens, []byte(\"\\\\<br /\\\\>\"), []byte(\"<br />\"))\n\t\t\t}\n\t\tcase ast.NodeInlineMath:\n\t\t\twithMath = true\n\t\tcase ast.NodeLinkDest:\n\t\t\tdest := n.TokensStr()\n\t\t\tif !options.SkipBase64Assets && strings.HasPrefix(dest, \"data:image\") && strings.Contains(dest, \";base64,\") {\n\t\t\t\tprocessBase64Img(n, dest, assetDirPath, boxID)\n\t\t\t}\n\t\t}\n\t\treturn ast.WalkContinue\n\t})\n\treturn\n}\n\nfunc ImportSY(zipPath, boxID, toPath string) (err error) {\n\tif isSYNotebookBundle(zipPath) {\n\t\treturn errors.New(Conf.Language(373))\n\t}\n\t_, err = importSY(zipPath, boxID, toPath, false, false)\n\treturn\n}\n\nfunc ImportSYNotebook(zipPath string) (boxID string, err error) {\n\treturn importSY(zipPath, \"\", \"/\", true, false)\n}\n\nvar ErrSYTargetNotebookRequired = errors.New(\"target notebook required\")\n\nfunc ImportSYAuto(zipPath, boxID, toPath string) (createdBoxID string, notebook bool, err error) {\n\tcreatedBoxID, err = importSY(zipPath, boxID, toPath, false, true)\n\tnotebook = err == nil && createdBoxID != boxID\n\treturn\n}\n\nfunc isSYNotebookExport(hasBoxConf, hasBoxDocMeta bool) bool {","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/import.go#L140-L176","documentation":"ImportSY refuses to import a zip that is itself an encrypted/plain SiYuan notebook bundle (isSYNotebookBundle detects the notebook-level .sy bundle structure). Notebook-level bundles must be imported with ImportSYNotebook/ImportSYAuto, not the into-existing-folder import path, because importing a whole notebook as a child document would corrupt the target structure. The message is the localized i18n string with key 373.","triggerScenarios":"Calling model.ImportSY (or the API import endpoint routed to it) with zipPath pointing to a full notebook export bundle while also supplying boxID/toPath targeting a folder inside a notebook.","commonSituations":"Users dragging a whole-notebook export (.sy notebook zip) into the document-level import dialog; automation scripts that always call ImportSY regardless of bundle type.","solutions":["Detect the bundle type first (isSYNotebookBundle) and call ImportSYNotebook or ImportSYAuto for notebook bundles","If importing from the UI, use the notebook-level import entry point instead of the within-notebook import","If you only need the documents, re-export them as a document tree zip (not a notebook bundle) and import that"],"exampleFix":"// before\nif err := model.ImportSY(zipPath, boxID, \"/docs\"); err != nil { ... }\n// after\nif isSYNotebookBundle(zipPath) {\n    boxID, err = model.ImportSYNotebook(zipPath)\n} else {\n    err = model.ImportSY(zipPath, boxID, \"/docs\")\n}","handlingStrategy":"validation","validationCode":"if model.IsSYNotebookBundle(zipPath) { // route to ImportSYNotebook/ImportSYAuto instead of ImportSY }","typeGuard":null,"tryCatchPattern":"if err := model.ImportSY(zipPath, boxID, toPath); err != nil && strings.Contains(err.Error(), Conf.Language(373)) { // fall back to notebook-level import }","preventionTips":["Inspect the zip structure before choosing the import API","Use ImportSYAuto when the bundle type is unknown","Educate users that notebook exports import via the notebook import entry"],"tags":["import","notebook","validation","i18n"],"backgroundTag":"unsupported-operation","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}