chenhg5/cc-connect · error

antigravity: initialize permission bridge: %w

Error message

antigravity: initialize permission bridge: %w

What it means

newAntigravitySession wraps any failure from newAgyPermissionBridge when the session mode is "default" (the only mode that needs the interactive permission bridge). If the bridge listener cannot be created or started, the session construction is aborted and the context cancelled.

Source

Thrown at agent/antigravity/session.go:63

	as := &antigravitySession{
		cmd:       cmd,
		extraArgs: extraArgs,
		workDir:   workDir,
		model:     model,
		mode:      mode,
		timeout:   timeout,
		extraEnv:  extraEnv,
		events:    make(chan core.Event, 64),
		ctx:       sessionCtx,
		cancel:    cancel,
	}
	as.alive.Store(true)

	if mode == "default" {
		bridge, err := newAgyPermissionBridge(sessionCtx, as.events)
		if err != nil {
			cancel()
			return nil, fmt.Errorf("antigravity: initialize permission bridge: %w", err)
		}
		as.permissionBridge = bridge
	}

	if resumeID != "" && resumeID != core.ContinueSession {
		as.chatID.Store(resumeID)
	}

	return as, nil
}

func (as *antigravitySession) Send(prompt string, messageID string, images []core.ImageAttachment, files []core.FileAttachment) error {
	if !as.alive.Load() {
		return fmt.Errorf("session is closed")
	}

	// Capture existing chat logs so we can identify a new session on first turn
	preEntries := make(map[string]bool)

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Read the wrapped cause (%w) for the underlying listener error (bind/permission/fd).
  2. Raise fd limits if 'too many open files' appears: ulimit -n.
  3. Ensure the environment allows Unix/TCP sockets (container seccomp/apparmor profiles) or set a writable TMPDIR.
  4. Use a non-default mode (e.g. yolo/acceptEdits) if interactive permission prompts are not needed.

Example fix

// config.toml
// before
[agents.antigravity]
mode = "default"   # fails in sandbox without sockets
// after (non-interactive environment)
[agents.antigravity]
mode = "yolo"
Defensive patterns

Strategy: fallback

Validate before calling

// pre-check in restrictive environments
if _, err := net.Listen("unix", filepath.Join(os.TempDir(), "agy-probe.sock")); err != nil {
    // sockets unavailable — configure a non-interactive mode
}

Try / catch

session, err := StartSession(ctx, opts)
if err != nil && strings.Contains(err.Error(), "initialize permission bridge") {
    opts.Mode = "yolo" // or alert the user that interactive mode is unavailable
    session, err = StartSession(ctx, opts)
}

Prevention

When it happens

Trigger: StartSession with mode=default where the bridge cannot bind its listener — e.g. no available local socket, temp dir not writable, or OS refusing socket creation (fd limits, seccomp/containers blocking Unix sockets).

Common situations: Running inside restricted Docker containers/sandboxes that disallow Unix domain sockets; hitting the process fd limit; read-only TMPDIR; permission bridge listener path collisions.

Related errors


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