{"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":157,"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":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/import.go#L139-L175","documentation":"ImportSY rejects an archive whose contents are detected as a full notebook bundle (.sy.zip exported as a whole notebook) because the public ImportSY API is meant for importing document-level .sy files, not entire notebooks. The message comes from i18n key 373: 'This archive contains notebook data. Please import it from [Document Tree - More - Import Notebook]'.","triggerScenarios":"Calling model.ImportSY(zipPath, boxID, toPath) with a zipPath that isSYNotebookBundle identifies as a notebook export (contains notebook-level .siyuan/conf.json or notebook doc metadata instead of plain document .sy files).","commonSituations":"User (or plugin) picked the wrong import entry point — dragging a notebook-exported .sy.zip into a document import flow; automations calling the import API with a notebook archive; confusion between .sy.zip exported from the doc tree vs from Settings.","solutions":["Use ImportSYNotebook(zipPath) or ImportSYNotebookBundle instead of ImportSY for notebook archives","Re-export only individual documents (.sy files) if the target is document import via ImportSY","In the UI, import via Document Tree - More - Import Notebook as the message suggests"],"exampleFix":"// before\nerr := model.ImportSY(zipPath, boxID, toPath)\n// after\nif model.IsSYNotebookBundle(zipPath) {\n    boxID, err = model.ImportSYNotebook(zipPath)\n} else {\n    err = model.ImportSY(zipPath, boxID, toPath)\n}","handlingStrategy":"validation","validationCode":"// detect bundle type before choosing the import API\nif isSYNotebookBundle(zipPath) {\n    return model.ImportSYNotebook(zipPath)\n}\nreturn model.ImportSY(zipPath, boxID, toPath)","typeGuard":null,"tryCatchPattern":"// Go caller\nif err := model.ImportSY(zipPath, boxID, toPath); err != nil {\n    // message is localized (Language 373): retry with notebook import\n    if _, nbErr := model.ImportSYNotebook(zipPath); nbErr == nil {\n        return nil\n    }\n    return err\n}","preventionTips":["Route notebook-level .sy.zip archives to ImportSYNotebook/ImportSYNotebookBundle, not ImportSY","When exposing import UIs, detect archive type first instead of assuming document import","Educate users on the two export types (document .sy vs notebook .sy.zip)"],"tags":["import","notebook","wrong-api","archive"],"backgroundTag":"unsupported-operation","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}