{"record":{"id":"7eefbeb3b9521d6a","repo":"siyuan-note/siyuan","slug":"conf-language-198","errorCode":null,"errorMessage":"Conf.Language(198)","messagePattern":"Conf\\.Language\\(198\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/import.go","lineNumber":1414,"sourceCode":"\n\tlogging.LogInfof(\"import data from [%s]\", zipPath)\n\tbaseName := filepath.Base(zipPath)\n\text := filepath.Ext(baseName)\n\tbaseName = strings.TrimSuffix(baseName, ext)\n\tunzipPath := filepath.Join(filepath.Dir(zipPath), baseName)\n\terr = gulu.Zip.Unzip(zipPath, unzipPath)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer os.RemoveAll(unzipPath)\n\n\tfiles, err := filepath.Glob(filepath.Join(unzipPath, \"*/*.sy\"))\n\tif err != nil {\n\t\tlogging.LogErrorf(\"check data.zip failed: %s\", err)\n\t\treturn errors.New(\"check data.zip failed\")\n\t}\n\tif 0 < len(files) {\n\t\treturn errors.New(Conf.Language(198))\n\t}\n\tdirs, err := os.ReadDir(unzipPath)\n\tif err != nil {\n\t\tlogging.LogErrorf(\"check data.zip failed: %s\", err)\n\t\treturn errors.New(\"check data.zip failed\")\n\t}\n\tif 1 != len(dirs) {\n\t\treturn errors.New(Conf.Language(198))\n\t}\n\n\ttmpDataPath := filepath.Join(unzipPath, dirs[0].Name())\n\ttmpDataEmojisPath := filepath.Join(tmpDataPath, \"emojis\")\n\tfilelock.Walk(tmpDataEmojisPath, func(path string, d fs.DirEntry, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif d == nil {\n\t\t\treturn nil","sourceCodeStart":1396,"sourceCodeEnd":1432,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/import.go#L1396-L1432","documentation":"The unzipped data.zip contains .sy document files at '*/*.sy' depth, meaning the archive holds raw notebook directories directly instead of the expected single top-level 'data' directory wrapping them. ImportData rejects this with the localized message i18n key 198 (Conf.Language(198)).","triggerScenarios":"ImportData where filepath.Glob(unzipPath/*/*.sy) matches at least one file — e.g. the zip was built from the workspace root so notebooks sit one level down instead of under a single 'data/' folder.","commonSituations":"Users zipping the workspace directory themselves instead of using SiYuan's 'Export data.zip'; zips that mix notebook folders and other files at the top level.","solutions":["Rebuild the zip so all content sits under exactly one top-level directory (the 'data' folder), then re-import","Use SiYuan's built-in 'Export data.zip' (Settings - Export) instead of manually zipping the workspace","Unzip locally, restructure into <top-dir>/<notebook>/*.sy, re-zip, and retry"],"exampleFix":"// before (rejected): notebooks at zip root level\n// data.zip -> notebook-xxx/*.sy\n// after (accepted): single top-level data directory\n// data.zip -> data/notebook-xxx/*.sy","handlingStrategy":"validation","validationCode":"// Caller-side: verify the zip layout matches data/<notebook>/*.sy before import\nentries, _ := zip.OpenReader(zipPath)\nhasSyAtRoot := false\nfor _, f := range entries.File {\n    parts := strings.SplitN(f.Name, \"/\", 3)\n    if len(parts) == 3 && strings.HasSuffix(parts[2], \".sy\") {\n        // .sy two levels deep: notebook directly under archive root — will be rejected\n        hasSyAtRoot = true\n    }\n}\nif hasSyAtRoot { return errors.New(\"zip must contain a single top-level data directory\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always zip the 'data' directory itself, not its parent workspace folder","Use SiYuan's built-in export instead of manual zipping","Validate archive structure with a zip listing before importing","Keep exactly one top-level directory in any hand-built archive"],"tags":["import","zip","structure"],"backgroundTag":"invalid-argument-format","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"}