chenhg5/cc-connect · error

write Agy hooks overlay: %w

Error message

write Agy hooks overlay: %w

What it means

createAgyConfigOverlay writes the final merged hooks JSON to <rootDir>/agy-config/config/hooks.json with mode 0600. If os.WriteFile fails, the overlay is incomplete and this wrapped error is returned, aborting bridge creation.

Source

Thrown at agent/antigravity/permission_bridge.go:161

						"command": shellQuote(executable) + " _agy-permission-hook",
						"timeout": 86400,
					},
				},
			},
		},
	})
	if err != nil {
		return "", fmt.Errorf("marshal Agy permission hook: %w", err)
	}
	hooks[agyPermissionHookName] = bridgeHook

	data, err := json.MarshalIndent(hooks, "", "  ")
	if err != nil {
		return "", fmt.Errorf("marshal Agy hooks overlay: %w", err)
	}
	data = append(data, '\n')
	if err := os.WriteFile(filepath.Join(overlayConfigDir, "hooks.json"), data, 0o600); err != nil {
		return "", fmt.Errorf("write Agy hooks overlay: %w", err)
	}
	return overlayConfigRoot, nil
}

func mirrorDirectoryEntries(sourceDir, targetDir string, skip map[string]bool) error {
	entries, err := os.ReadDir(sourceDir)
	if os.IsNotExist(err) {
		return nil
	}
	if err != nil {
		return fmt.Errorf("read Agy config directory %s: %w", sourceDir, err)
	}
	for _, entry := range entries {
		if skip[entry.Name()] {
			continue
		}
		source := filepath.Join(sourceDir, entry.Name())
		target := filepath.Join(targetDir, entry.Name())

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Check free space on the filesystem backing rootDir/TMPDIR (df -h) and free up space if needed.
  2. Point TMPDIR (or the cc-connect temp root) at a writable volume and retry.
  3. Verify the agy-config/config directory created moments earlier is still writable (no concurrent chmod/AV interference).
  4. Re-run the session start once transient I/O errors (EINTR, NFS hiccups) have cleared.

Example fix

// before: read-only temp volume
$ df -h /tmp → 100% full
// after
cleanup /tmp or TMPDIR=/var/tmp cc-connect
Defensive patterns

Strategy: retry

Validate before calling

// shell: confirm the temp volume has space and is writable before start
[ -w "${TMPDIR:-/tmp}" ] && [ "$(df --output=pcent "${TMPDIR:-/tmp}" | tail -1 | tr -dc 0-9)" -lt 95 ] \
  || echo "temp volume not writable or nearly full"

Try / catch

if err := startAntigravitySession(); err != nil && strings.Contains(err.Error(), "write Agy hooks overlay") {
    // free disk space or relocate TMPDIR, then retry once
}

Prevention

When it happens

Trigger: newAgyPermissionBridge → createAgyConfigOverlay when writing the overlay hooks.json fails: disk full, read-only filesystem, or the file/dir permissions changed between MkdirAll and WriteFile.

Common situations: Full disk on the temp volume, TMPDIR on a read-only mount, aggressive security software locking new files, or quota limits on the temp filesystem.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


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