chenhg5/cc-connect · error

antigravity: unknown permission request %q

Error message

antigravity: unknown permission request %q

What it means

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.

Source

Thrown at agent/antigravity/permission_bridge.go:318

	return string(data)
}

func (b *agyPermissionBridge) writeResponse(conn net.Conn, response antigravityhook.BridgeResponse) {
	_ = json.NewEncoder(conn).Encode(response)
}

func (b *agyPermissionBridge) RespondPermission(requestID string, result core.PermissionResult) error {
	behavior := strings.ToLower(strings.TrimSpace(result.Behavior))
	if behavior != "allow" && behavior != "deny" {
		return fmt.Errorf("antigravity: invalid permission behavior %q", result.Behavior)
	}
	result.Behavior = behavior

	b.pendingMu.Lock()
	ch := b.pending[requestID]
	b.pendingMu.Unlock()
	if ch == nil {
		return fmt.Errorf("antigravity: unknown permission request %q", requestID)
	}
	select {
	case ch <- result:
		return nil
	default:
		return fmt.Errorf("antigravity: permission request %q is already resolved", requestID)
	}
}

func (b *agyPermissionBridge) Close() {
	b.closeOnce.Do(func() {
		b.cancel()
		_ = b.listener.Close()
		b.wg.Wait()
		_ = os.RemoveAll(b.rootDir)
	})
}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Discard the stale response — the request is no longer pending; re-issue the prompt to get a new permission request ID.
  2. Ensure each core permission event's requestID is answered exactly once and removed from the UI after answering.
  3. After restarting cc-connect, don't answer old permission cards.
  4. Check that requestID is passed through your platform callback unchanged (no re-render truncation).

Example fix

// before: answering a cached card
bridge.RespondPermission(oldRequestID, result)
// after: only answer IDs from live events
if _, ok := activeRequests[requestID]; ok {
    bridge.RespondPermission(requestID, result)
    delete(activeRequests, requestID)
}
Defensive patterns

Strategy: try-catch

Try / catch

if err := bridge.RespondPermission(id, result); err != nil && strings.Contains(err.Error(), "unknown permission request") {
    slog.Warn("stale permission response ignored", "requestID", id)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/95497c6615895605. Report an issue: GitHub.