{"record":{"id":"126c29c23d234684","repo":"chenhg5/cc-connect","slug":"cc-connect-binary-not-found-in-archive","errorCode":null,"errorMessage":"cc-connect binary not found in archive","messagePattern":"cc-connect binary not found in archive","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/updater.go","lineNumber":223,"sourceCode":"\t\treturn nil, err\n\t}\n\tdefer gr.Close()\n\n\ttr := tar.NewReader(gr)\n\tfor {\n\t\thdr, err := tr.Next()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tname := filepath.Base(hdr.Name)\n\t\tif strings.HasPrefix(name, \"cc-connect\") && hdr.Typeflag == tar.TypeReg {\n\t\t\treturn io.ReadAll(tr)\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"cc-connect binary not found in archive\")\n}\n\nfunc extractBinaryFromZip(data []byte) ([]byte, error) {\n\tr, err := zip.NewReader(bytes.NewReader(data), int64(len(data)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, f := range r.File {\n\t\tname := filepath.Base(f.Name)\n\t\tif strings.HasPrefix(name, \"cc-connect\") && !f.FileInfo().IsDir() {\n\t\t\trc, err := f.Open()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tdefer rc.Close()\n\t\t\treturn io.ReadAll(rc)\n\t\t}\n\t}","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/updater.go#L205-L241","documentation":"extractBinaryFromTarGz walks every header in the downloaded tar.gz and returns this error when no regular file whose basename starts with \"cc-connect\" is found. It means the archive downloaded fine but does not contain the expected binary entry.","triggerScenarios":"SelfUpdate downloaded a tar.gz whose entries do not include a regular file named cc-connect* (basename match, tar.TypeReg): wrong artifact downloaded (source archive, checksums-only archive), asset renamed to e.g. ccon/agent binary, binary nested under a name not starting with cc-connect, or a symlink-only entry (Typeflag != TypeReg).","commonSituations":"Release process changed the binary name inside the archive; user mirrored/renamed assets; platform asset mismatch (macOS .zip downloaded but routed to tar.gz extraction); archive contains directory entries only because upload flattened wrongly.","solutions":["Download the archive and run `tar -tzf <archive>` to list entries; confirm a regular file whose basename starts with cc-connect exists.","Fix the release asset so it contains a regular (not symlink) file named cc-connect* (or the platform-suffixed name still starting with cc-connect).","Update the updater's extraction match if the official binary was renamed — the check is prefix + tar.TypeReg only.","If your mirror wraps the binary in a top-level folder, that is fine (filepath.Base is used) — the problem is the final basename, so rename the file inside the archive.","As a workaround, extract manually and replace the binary in place, then restart."],"exampleFix":"// release CI: before\nmv cc-connect-agent ccagent && tar czf cc-connect.tar.gz ccagent\n// after\ntar czf cc-connect.tar.gz cc-connect","handlingStrategy":"validation","validationCode":"out, _ := exec.Command(\"tar\", \"-tzf\", archivePath).Output()\nif !strings.Contains(string(out), \"cc-connect\") {\n    return fmt.Errorf(\"archive lacks cc-connect binary: %s\", out)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify release asset contents in CI with tar -tzf before publishing","Keep the binary basename prefixed with cc-connect in all packaging scripts","Smoke-test the self-update path in a staging release"],"tags":["archive","tar","self-update"],"backgroundTag":"resource-not-found","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}