{"record":{"id":"076672e46393aee3","repo":"xpzouying/xiaohongshu-mcp","slug":"s-076672","errorCode":null,"errorMessage":"不支持的压缩格式: %s","messagePattern":"不支持的压缩格式: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"browser/browser_download.go","lineNumber":217,"sourceCode":"\tf, err := os.Create(dst)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\t_, err = io.Copy(f, resp.Body)\n\treturn err\n}\n\nfunc extractArchive(archivePath, destDir string) error {\n\tswitch {\n\tcase strings.HasSuffix(archivePath, \".tar.xz\"):\n\t\treturn extractTarXz(archivePath, destDir)\n\tcase strings.HasSuffix(archivePath, \".zip\"):\n\t\treturn extractZip(archivePath, destDir)\n\tcase strings.HasSuffix(archivePath, \".dmg\"):\n\t\treturn extractDmg(archivePath, destDir)\n\t}\n\treturn fmt.Errorf(\"不支持的压缩格式: %s\", archivePath)\n}\n\nfunc extractTarXz(archivePath, destDir string) error {\n\tf, err := os.Open(archivePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\txzr, err := xz.NewReader(f)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttr := tar.NewReader(xzr)\n\tfor {\n\t\thdr, err := tr.Next()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/browser/browser_download.go#L199-L235","documentation":"extractArchive dispatches on the archive filename suffix: .tar.xz, .zip, and .dmg are supported. This error is thrown when the downloaded archive has an extension none of these cases match, so the library refuses to guess how to unpack it.","triggerScenarios":"EnsureBrowser downloads a browser archive whose filename does not end in .tar.xz, .zip, or .dmg, then calls extractArchive(archivePath, destDir) which falls through all cases to the final fmt.Errorf.","commonSituations":"Upstream changed the packaging format (e.g. switched to .tar.bz2 or .7z); a proxy served a compressed or HTML response saved under an unexpected filename; the archive was manually placed/renamed in the cache directory; a new OS target ships a different archive type.","solutions":["Check the actual filename and `file` type of the downloaded archive in the cache directory","Re-run EnsureBrowser after clearing the cache so a fresh, correctly named archive is downloaded","If upstream switched formats, update the library or extend extractArchive with a case for the new suffix","If a proxy is corrupting the response, bypass it for the download host","Manually extract the archive into the expected destination directory and re-run to skip re-download"],"exampleFix":"// before\nreturn fmt.Errorf(\"不支持的压缩格式: %s\", archivePath)\n// after — support the new format\ncase strings.HasSuffix(archivePath, \".tar.bz2\"):\n\treturn extractTarBz2(archivePath, destDir)\ndefault:\n\treturn fmt.Errorf(\"不支持的压缩格式: %s\", archivePath)","handlingStrategy":"validation","validationCode":"switch {\ncase strings.HasSuffix(path, \".tar.xz\"), strings.HasSuffix(path, \".zip\"), strings.HasSuffix(path, \".dmg\"):\n\t// 支持的格式\ndefault:\n\treturn fmt.Errorf(\"archive format not supported: %s\", filepath.Ext(path))\n}","typeGuard":null,"tryCatchPattern":"if err := EnsureBrowser(ctx); err != nil {\n\tif strings.Contains(err.Error(), \"不支持的压缩格式\") {\n\t\t// 清理缓存后重新下载，或手动解压到目标目录\n\t\tos.RemoveAll(cacheDir)\n\t\terr = EnsureBrowser(ctx)\n\t}\n\tif err != nil { return err }\n}","preventionTips":["Clear the browser cache directory before retrying so a fresh archive is fetched","Verify the downloaded file's type with `file` if extensions look odd","Keep the library updated when upstream changes packaging","Never rename/move cached archives manually"],"tags":["archive","extraction","unsupported-format"],"backgroundTag":"unsupported-archive-format","analyzedSha":"332d196854a9eac0d2b8c2c0e3d0cc43139d724c","analyzedAt":"2026-09-05T22:22:55.988Z","contentChangedAt":"2026-09-05T22:22:55.988Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}