chenhg5/cc-connect · error
antigravity permission bridge: %w
Error message
antigravity permission bridge: %w
What it means
The antigravity permission bridge accept loop wraps errors from listener.Accept() and forwards them to the session event stream as a core.EventError. It is thrown when the bridge's Unix/TCP listener fails while accepting a connection and the bridge context has not been cancelled — i.e. an unexpected listener failure, not normal shutdown.
Source
Thrown at agent/antigravity/permission_bridge.go:214
}
func (b *agyPermissionBridge) Env() []string {
return []string{
antigravityhook.EnvAddress + "=" + b.address,
antigravityhook.EnvToken + "=" + b.token,
}
}
func (b *agyPermissionBridge) AgyConfigDir() string { return b.configDir }
func (b *agyPermissionBridge) acceptLoop() {
defer b.wg.Done()
for {
conn, err := b.listener.Accept()
if err != nil {
if b.ctx.Err() == nil {
select {
case b.events <- core.Event{Type: core.EventError, Error: fmt.Errorf("antigravity permission bridge: %w", err)}:
case <-b.ctx.Done():
}
}
return
}
b.wg.Add(1)
go b.handleConnection(conn)
}
}
func (b *agyPermissionBridge) handleConnection(conn net.Conn) {
defer b.wg.Done()
defer func() { _ = conn.Close() }()
_ = conn.SetReadDeadline(time.Now().Add(10 * time.Second))
var request antigravityhook.BridgeRequest
if err := json.NewDecoder(io.LimitReader(conn, 4<<20)).Decode(&request); err != nil {
b.writeResponse(conn, antigravityhook.BridgeResponse{Decision: "deny", Reason: "invalid cc-connect permission bridge request"})View on GitHub (pinned to 4000b2338a)
Solutions
- Check the wrapped cause (%w) — 'use of closed network connection' means the bridge is shutting down and the error can be ignored if context is done.
- Raise the process fd limit (ulimit -n) if EMFILE/ENFILE appears.
- Verify nothing else deletes or closes the socket file/path used by the listener.
- Restart cc-connect; if persistent, check OS network/firewall health for the listen address.
Defensive patterns
Strategy: try-catch
Try / catch
for ev := range session.Events() {
if ev.Type == core.EventError && strings.Contains(ev.Error.Error(), "antigravity permission bridge:") {
// log and re-create the bridge/session unless shutting down
}
} Prevention
- Raise ulimit -n on hosts with many concurrent sessions.
- Don't delete the bridge socket path while the bridge is running.
- Treat errors occurring after context cancellation as normal shutdown noise.
When it happens
Trigger: Accept() returns an error (e.g. listener closed externally, fd exhaustion, temporary network error made permanent) while b.ctx is still live during newAgyPermissionBridge's acceptLoop.
Common situations: System fd limit reached under many concurrent sessions; listener socket removed/closed underneath the bridge; OS-level network stack issues on TCP listeners.
Understand the failure class
Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.
Related errors
- listen for Agy permission hooks: %w
- antigravity: initialize permission bridge: %w
- generate permission bridge token: %w
- resolve home directory for Agy permission bridge: %w
- create Agy permission overlay: %w
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/a20b9f0fd1131788.
Report an issue: GitHub.