{"record":{"id":"95497c6615895605","repo":"chenhg5/cc-connect","slug":"antigravity-unknown-permission-request-q","errorCode":null,"errorMessage":"antigravity: unknown permission request %q","messagePattern":"antigravity: unknown permission request %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/antigravity/permission_bridge.go","lineNumber":318,"sourceCode":"\treturn string(data)\n}\n\nfunc (b *agyPermissionBridge) writeResponse(conn net.Conn, response antigravityhook.BridgeResponse) {\n\t_ = json.NewEncoder(conn).Encode(response)\n}\n\nfunc (b *agyPermissionBridge) RespondPermission(requestID string, result core.PermissionResult) error {\n\tbehavior := strings.ToLower(strings.TrimSpace(result.Behavior))\n\tif behavior != \"allow\" && behavior != \"deny\" {\n\t\treturn fmt.Errorf(\"antigravity: invalid permission behavior %q\", result.Behavior)\n\t}\n\tresult.Behavior = behavior\n\n\tb.pendingMu.Lock()\n\tch := b.pending[requestID]\n\tb.pendingMu.Unlock()\n\tif ch == nil {\n\t\treturn fmt.Errorf(\"antigravity: unknown permission request %q\", requestID)\n\t}\n\tselect {\n\tcase ch <- result:\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"antigravity: permission request %q is already resolved\", requestID)\n\t}\n}\n\nfunc (b *agyPermissionBridge) Close() {\n\tb.closeOnce.Do(func() {\n\t\tb.cancel()\n\t\t_ = b.listener.Close()\n\t\tb.wg.Wait()\n\t\t_ = os.RemoveAll(b.rootDir)\n\t})\n}\n","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/antigravity/permission_bridge.go#L300-L336","documentation":"RespondPermission looks up the pending permission channel by requestID; if no request with that ID is registered, the bridge returns this error. The request either never existed, was already delivered and removed, or the bridge was restarted and lost its pending map.","triggerScenarios":"Calling RespondPermission with an ID not present in b.pending: answering after the request timed out or the session was recreated; a duplicate response for the same request after the entry was consumed; IDs mangled between the event and the response.","commonSituations":"Users double-clicking a permission button; a platform adapter caching an old card and answering a stale request; cc-connect restarted while a permission card was still visible in chat.","solutions":["Discard the stale response — the request is no longer pending; re-issue the prompt to get a new permission request ID.","Ensure each core permission event's requestID is answered exactly once and removed from the UI after answering.","After restarting cc-connect, don't answer old permission cards.","Check that requestID is passed through your platform callback unchanged (no re-render truncation)."],"exampleFix":"// before: answering a cached card\nbridge.RespondPermission(oldRequestID, result)\n// after: only answer IDs from live events\nif _, ok := activeRequests[requestID]; ok {\n    bridge.RespondPermission(requestID, result)\n    delete(activeRequests, requestID)\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := bridge.RespondPermission(id, result); err != nil && strings.Contains(err.Error(), \"unknown permission request\") {\n    slog.Warn(\"stale permission response ignored\", \"requestID\", id)\n}","preventionTips":["Remove/disable permission buttons after the first answer.","Don't persist permission request IDs across cc-connect restarts.","Answer permission requests promptly before timeouts clear them."],"tags":["go","permission","state","antigravity"],"backgroundTag":"record-not-found","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"}