{"record":{"id":"398b90fccb5b12b0","repo":"chenhg5/cc-connect","slug":"zip-w","errorCode":null,"errorMessage":"zip: %w","messagePattern":"zip: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/update.go","lineNumber":360,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\tif _, err := io.Copy(tmp, tr); err != nil {\n\t\t\t\ttmp.Close()\n\t\t\t\tos.Remove(tmp.Name())\n\t\t\t\treturn \"\", fmt.Errorf(\"extract: %w\", err)\n\t\t\t}\n\t\t\ttmp.Close()\n\t\t\treturn tmp.Name(), nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"binary not found in archive\")\n}\n\nfunc extractFromZip(archivePath string) (string, error) {\n\tr, err := zip.OpenReader(archivePath)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"zip: %w\", err)\n\t}\n\tdefer r.Close()\n\n\tfor _, f := range r.File {\n\t\tif !strings.HasPrefix(f.Name, \"cc-connect\") {\n\t\t\tcontinue\n\t\t}\n\t\trc, err := f.Open()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\ttmp, err := os.CreateTemp(\"\", \"cc-connect-update-*\")\n\t\tif err != nil {\n\t\t\trc.Close()\n\t\t\treturn \"\", err\n\t\t}\n\t\tif _, err := io.Copy(tmp, rc); err != nil {\n\t\t\ttmp.Close()","sourceCodeStart":342,"sourceCodeEnd":378,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/update.go#L342-L378","documentation":"Raised when extractFromZip cannot open the downloaded update archive as a valid ZIP file — corrupt download, truncated file, or wrong archive format. It wraps zip.OpenReader's error and aborts the self-update before the cc-connect binary is extracted.","triggerScenarios":"Thrown at cmd/cc-connect/update.go:360 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the update — the download may have been truncated","Check disk space and network stability","Download the release manually if the archive is persistently corrupt"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}