chenhg5/cc-connect · error

create Agy permission overlay

Error message

create Agy permission overlay: %w

What it means

createAgyConfigOverlay creates the overlay config directory (<rootDir>/agy-config/config) with MkdirAll where the mirrored Antigravity hooks.json will be written. If directory creation fails, the overlay cannot be prepared and this wrapped error is returned.

Solutions

  1. Check disk space (df -h) and free space on the filesystem backing rootDir/TMPDIR.
  2. Verify the directory is writable by the cc-connect user; adjust permissions or TMPDIR.
  3. Look for a non-directory file at the target path and remove it.
  4. If the filesystem is mounted read-only (common in read-only containers), point TMPDIR/CC-Connect temp storage at a writable volume.

Example fix

// before
TMPDIR=/readonly/tmp cc-connect
// after
TMPDIR=/var/tmp cc-connect
Defensive patterns

Strategy: validation

Validate before calling

// Go: ensure the temp root is writable before creating sessions
d := filepath.Join(os.TempDir(), "cc-connect-probe")
if err := os.MkdirAll(d, 0o700); err != nil {
    return fmt.Errorf("temp dir not writable: %w", err)
}
os.Remove(d)

Try / catch

if err := startAntigravitySession(); err != nil && strings.Contains(err.Error(), "create Agy permission overlay") {
    // check TMPDIR writability and disk space before retry
}

Prevention

When it happens

Trigger: newAgyPermissionBridge → createAgyConfigOverlay when os.MkdirAll on the temp rootDir's agy-config/config path fails (e.g. parent not writable, disk full, path exists as a file).

Common situations: Read-only filesystem or full disk for the temp directory, TMPDIR pointing to a non-writable path, a stale file conflicting with the directory path, or running as a user without write permission to rootDir.

Understand the failure class

Background: mkdir permission denied (EACCES): failed to create directory errors explained — this error's family across 32 libraries.

Related errors


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

Appendix: source

Thrown at agent/antigravity/permission_bridge.go:108

		pending:   make(map[string]chan core.PermissionResult),
	}
	bridge.wg.Add(1)
	go bridge.acceptLoop()
	return bridge, nil
}

func createAgyConfigOverlay(rootDir string) (string, error) {
	homeDir, err := os.UserHomeDir()
	if err != nil {
		return "", fmt.Errorf("resolve home directory for Agy permission bridge: %w", err)
	}
	// Antigravity currently stores its CLI state under .gemini and exposes it
	// through the --gemini_dir compatibility flag.
	realConfigRoot := filepath.Join(homeDir, ".gemini")
	overlayConfigRoot := filepath.Join(rootDir, "agy-config")
	overlayConfigDir := filepath.Join(overlayConfigRoot, "config")
	if err := os.MkdirAll(overlayConfigDir, 0o700); err != nil {
		return "", fmt.Errorf("create Agy permission overlay: %w", err)
	}

	if err := mirrorDirectoryEntries(realConfigRoot, overlayConfigRoot, map[string]bool{"config": true}); err != nil {
		return "", err
	}
	realConfigDir := filepath.Join(realConfigRoot, "config")
	if err := mirrorDirectoryEntries(realConfigDir, overlayConfigDir, map[string]bool{"hooks.json": true}); err != nil {
		return "", err
	}

	hooks := make(map[string]json.RawMessage)
	hooksPath := filepath.Join(realConfigDir, "hooks.json")
	if data, err := os.ReadFile(hooksPath); err == nil {
		if err := json.Unmarshal(data, &hooks); err != nil {
			return "", fmt.Errorf("parse existing Agy hooks %s: %w", hooksPath, err)
		}
		if hooks == nil {
			hooks = make(map[string]json.RawMessage)

View on GitHub (pinned to 4000b2338a)