{"record":{"id":"a20b9f0fd1131788","repo":"chenhg5/cc-connect","slug":"antigravity-permission-bridge-w","errorCode":null,"errorMessage":"antigravity permission bridge: %w","messagePattern":"antigravity permission bridge: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/antigravity/permission_bridge.go","lineNumber":214,"sourceCode":"}\n\nfunc (b *agyPermissionBridge) Env() []string {\n\treturn []string{\n\t\tantigravityhook.EnvAddress + \"=\" + b.address,\n\t\tantigravityhook.EnvToken + \"=\" + b.token,\n\t}\n}\n\nfunc (b *agyPermissionBridge) AgyConfigDir() string { return b.configDir }\n\nfunc (b *agyPermissionBridge) acceptLoop() {\n\tdefer b.wg.Done()\n\tfor {\n\t\tconn, err := b.listener.Accept()\n\t\tif err != nil {\n\t\t\tif b.ctx.Err() == nil {\n\t\t\t\tselect {\n\t\t\t\tcase b.events <- core.Event{Type: core.EventError, Error: fmt.Errorf(\"antigravity permission bridge: %w\", err)}:\n\t\t\t\tcase <-b.ctx.Done():\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tb.wg.Add(1)\n\t\tgo b.handleConnection(conn)\n\t}\n}\n\nfunc (b *agyPermissionBridge) handleConnection(conn net.Conn) {\n\tdefer b.wg.Done()\n\tdefer func() { _ = conn.Close() }()\n\t_ = conn.SetReadDeadline(time.Now().Add(10 * time.Second))\n\n\tvar request antigravityhook.BridgeRequest\n\tif err := json.NewDecoder(io.LimitReader(conn, 4<<20)).Decode(&request); err != nil {\n\t\tb.writeResponse(conn, antigravityhook.BridgeResponse{Decision: \"deny\", Reason: \"invalid cc-connect permission bridge request\"})","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/antigravity/permission_bridge.go#L196-L232","documentation":"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.","triggerScenarios":"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.","commonSituations":"System fd limit reached under many concurrent sessions; listener socket removed/closed underneath the bridge; OS-level network stack issues on TCP listeners.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"for ev := range session.Events() {\n    if ev.Type == core.EventError && strings.Contains(ev.Error.Error(), \"antigravity permission bridge:\") {\n        // log and re-create the bridge/session unless shutting down\n    }\n}","preventionTips":["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."],"tags":["go","network","listener","antigravity","permission-bridge"],"backgroundTag":"connection-refused","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"}