{"record":{"id":"05b192287db5c3ec","repo":"siyuan-note/siyuan","slug":"check-data-zip-failed","errorCode":null,"errorMessage":"check data.zip failed","messagePattern":"check data\\.zip failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/import.go","lineNumber":1411,"sourceCode":"\n\tlockSync()\n\tdefer unlockSync()\n\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","sourceCodeStart":1393,"sourceCodeEnd":1429,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/import.go#L1393-L1429","documentation":"ImportData checks the unzipped archive layout: it globs for '*/*.sy' and reads the top-level directory. If either the Glob call or os.ReadDir fails at the OS level (unexpected I/O error, not a layout problem), the generic error 'check data.zip failed' is returned. The real cause is logged to the kernel log.","triggerScenarios":"ImportData when filepath.Glob returns a non-nil error (rare, e.g. malformed pattern path) or os.ReadDir on the unzip directory fails (permission error, unzip directory removed concurrently, path too long).","commonSituations":"Running the kernel without read permission on the extraction directory; antivirus or cleanup tools deleting the temp unzip dir mid-import; excessively long paths on Windows.","solutions":["Check the kernel log for the line 'check data.zip failed: <cause>' to see the underlying OS error","Fix permissions on the directory containing the zip and its extraction folder","Exclude the workspace from antivirus/cleanup tools that delete temp directories","Retry the import; if it persists, move the zip to a short local path (e.g. C:\\tmp or /tmp) and retry"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Caller-side: ensure the extraction location is readable before import\nif _, err := os.Stat(filepath.Dir(zipPath)); err != nil {\n    return fmt.Errorf(\"import source dir unreadable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"err := model.ImportData(zipPath)\nif err != nil && err.Error() == \"check data.zip failed\" {\n    // read kernel log for the underlying os error, fix permissions/disk, retry once\n    log.Printf(\"import layout check failed; see kernel log for cause\")\n}","preventionTips":["Run the kernel with read access to the directory holding the zip","Keep archives on local disks, not flaky network/removable drives","Exclude workspace and temp paths from antivirus real-time scanning","Retry transient I/O failures before diagnosing further"],"tags":["filesystem","import","io"],"backgroundTag":"file-read-failed","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"}