chenhg5/cc-connect · error
chmod: %w
Error message
chmod: %w
What it means
Wraps a failed os.Chmod(0755) on the downloaded replacement binary in replaceExecutable. It fires when the temp file cannot be marked executable — unusual filesystems, or the temp file vanished (cleaned by another process).
Source
Thrown at cmd/cc-connect/update.go:430
if err != nil {
return "", err
}
size, err := io.Copy(tmp, resp.Body)
if err != nil {
tmp.Close()
os.Remove(tmp.Name())
return "", fmt.Errorf("write: %w", err)
}
tmp.Close()
fmt.Printf("Downloaded %.1f MB\n", float64(size)/1024/1024)
return tmp.Name(), nil
}
func replaceExecutable(target, src string) error {
if err := os.Chmod(src, 0o755); err != nil {
return fmt.Errorf("chmod: %w", err)
}
// On Windows, rename over a running exe is not possible directly.
// Move old binary aside, then move new one in.
backup := target + ".old"
os.Remove(backup)
if err := os.Rename(target, backup); err != nil {
return fmt.Errorf("backup old binary: %w", err)
}
if err := copyFile(src, target); err != nil {
// Attempt to restore
if restoreErr := os.Rename(backup, target); restoreErr != nil {
slog.Warn("update: failed to restore old binary after copy error", "error", restoreErr)
}
return fmt.Errorf("install new binary: %w", err)
}View on GitHub (pinned to 4000b2338a)
Solutions
- Check that TMPDIR is not on a noexec/odd filesystem
- Point TMPDIR to a normal local directory
- Retry the update
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at cmd/cc-connect/update.go:430 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/4ca20985f7a6f832.
Report an issue: GitHub.