{"record":{"id":"612945c186c7f1b9","repo":"siyuan-note/siyuan","slug":"conf-language-199","errorCode":null,"errorMessage":"Conf.Language(199)","messagePattern":"Conf\\.Language\\(199\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/import.go","lineNumber":353,"sourceCode":"\t\t\treturn err\n\t\t}\n\t\tif d == nil {\n\t\t\treturn nil\n\t\t}\n\t\tif !d.IsDir() && strings.HasSuffix(d.Name(), \".sy\") {\n\t\t\tsyPaths = append(syPaths, path)\n\t\t}\n\t\treturn nil\n\t})\n\n\tentries, err := os.ReadDir(unzipPath)\n\tif err != nil {\n\t\tlogging.LogErrorf(\"read unzip dir [%s] failed: %s\", unzipPath, err)\n\t\treturn\n\t}\n\tif 1 != len(entries) || !entries[0].IsDir() {\n\t\tlogging.LogErrorf(\"invalid .sy.zip [%v]\", entries)\n\t\terr = errors.New(Conf.Language(199))\n\t\treturn\n\t}\n\tunzipRootPath := filepath.Join(unzipPath, entries[0].Name())\n\tname := filepath.Base(unzipRootPath)\n\tif strings.HasPrefix(name, \"data-20\") && len(\"data-20230321175442\") == len(name) {\n\t\tlogging.LogErrorf(\"invalid .sy.zip [unzipRootPath=%s, baseName=%s]\", unzipRootPath, name)\n\t\terr = errors.New(Conf.Language(199))\n\t\treturn\n\t}\n\tvar importedBoxConf *conf.BoxConf\n\timportedConfPath := filepath.Join(unzipRootPath, \".siyuan\", \"conf.json\")\n\thasImportedBoxConf := filelock.IsExist(importedConfPath)\n\tvar importedMetadataErr error\n\tif hasImportedBoxConf {\n\t\tconfData, readErr := filelock.ReadFile(importedConfPath)\n\t\tif readErr == nil {\n\t\t\timportedBoxConf = conf.NewBoxConf()\n\t\t\tif unmarshalErr := gulu.JSON.UnmarshalJSON(confData, importedBoxConf); unmarshalErr != nil {","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/import.go#L335-L371","documentation":"importSY0 validates the shape of an unpacked .sy.zip: the unzip directory must contain exactly one entry and it must be a directory. Anything else is rejected with i18n key 199 ('This is not a valid .sy.zip archive...'). This guards against arbitrary zips or archives with files at the root.","triggerScenarios":"Calling ImportSY / ImportSYAuto / ImportSYNotebookBundle with a zip that, after unzip, yields multiple entries at the top level or a top-level file instead of a single directory (e.g. a .sy.zip without its enclosing folder, a renamed random .zip, or a corrupted archive).","commonSituations":"Manually re-zipping documents without the single root folder; downloading a partial archive; passing a plain zip of .sy files instead of the exported .sy.zip; macOS archive tools that strip the wrapper folder.","solutions":["Re-export the .sy.zip from SiYuan (doc tree or Settings) without modifying the archive structure","Ensure the zip contains exactly one root directory (e.g. the notebook export folder)","If re-packaging manually, wrap all contents in a single top-level directory before zipping","Verify the archive is not corrupted (test extraction) before importing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// validate zip layout before import: exactly one top-level directory\nf, _ := zip.OpenReader(zipPath)\ndefer f.Close()\ntops := map[string]bool{}\nfor _, zf := range f.File {\n    parts := strings.SplitN(zf.Name, \"/\", 2)\n    tops[parts[0]] = true\n}\nif len(tops) != 1 {\n    return errors.New(\"zip must contain a single root directory\")\n}","typeGuard":null,"tryCatchPattern":"// Go caller\nif err := model.ImportSY(zipPath, boxID, toPath); err != nil {\n    logging.LogErrorf(\"invalid .sy.zip layout: %s\", err)\n    return fmt.Errorf(\"please re-export the archive from SiYuan\")\n}","preventionTips":["Never re-zip exported archives without their single root folder","Import only archives produced by SiYuan's export feature","Test-extract the zip before importing"],"tags":["import","archive","validation","zip"],"backgroundTag":"invalid-argument-format","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"}