chenhg5/cc-connect · error

antigravitySession: start: %w

Error message

antigravitySession: start: %w

What it means

Send wraps errors from cmd.Start() when launching the agy binary for a turn. The command could not be started at all — the binary was not found, is not executable, or the working directory/env cannot be set up.

Source

Thrown at agent/antigravity/session.go:196

		env = core.MergeEnv(env, as.extraEnv)
	}
	if as.permissionBridge != nil {
		env = core.MergeEnv(env, as.permissionBridge.Env())
	}
	cmd.Env = env

	// Keep stdin disconnected: agy --print consumes piped stdin to EOF before
	// processing the prompt, so an open pipe would deadlock the turn.
	stdout, err := cmd.StdoutPipe()
	if err != nil {
		return fmt.Errorf("antigravitySession: stdout pipe: %w", err)
	}

	var stderrBuf bytes.Buffer
	cmd.Stderr = &stderrBuf

	if err := cmd.Start(); err != nil {
		return fmt.Errorf("antigravitySession: start: %w", err)
	}

	started = true
	as.wg.Add(1)
	go func() {
		defer cancel()
		as.readLoop(ctx, cmd, stdout, &stderrBuf, append(imageRefs, fileRefs...), preEntries, time.Now())
	}()

	return nil
}

func (as *antigravitySession) buildAntigravityArgs(chatID string, isResume bool, mode, agyConfigDir, fullPrompt string) []string {
	// Prepend extra args from cmd so wrappers like "timeout 3600 agy" work.
	// Keep "-p <prompt>" at the very end because agy consumes the immediate next arg.
	args := append([]string{}, as.extraArgs...)
	if agyConfigDir != "" {
		// Antigravity currently names this compatibility flag --gemini_dir.

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Verify the binary exists and is executable: which agy && test -x $(which agy).
  2. Install/restore the agy CLI or fix the configured binary path in config.toml.
  3. For daemon deployments, set the full path to agy in config or extend the service's PATH/Environment in the systemd unit.
  4. Ensure the session's working directory exists and is accessible to the cc-connect user.
  5. Check the wrapped cause (%w) for the exact exec error.

Example fix

// config.toml
// before
[agents.antigravity]
# binary found via PATH (empty in systemd)
// after
[agents.antigravity]
command = "/usr/local/bin/agy"
Defensive patterns

Strategy: validation

Validate before calling

bin := "/usr/local/bin/agy" // or from config
if _, err := os.Stat(bin); err != nil || !isExecutable(bin) {
    // agy missing/not executable — fail fast with install guidance
}
func isExecutable(p string) bool {
    info, err := os.Stat(p)
    return err == nil && !info.IsDir() && info.Mode()&0o111 != 0
}

Try / catch

if err := session.Send(...); err != nil && strings.Contains(err.Error(), "antigravitySession: start:") {
    if strings.Contains(err.Error(), "executable file not found") {
        // prompt user to install agy or fix the configured command path
    }
}

Prevention

When it happens

Trigger: cmd.Start() failing because the agy executable is missing from PATH (exec: "agy": executable file not found in $PATH), lacks execute permission, or its configured working directory does not exist.

Common situations: agy CLI not installed or not on the daemon's PATH (systemd/launchd have minimal PATH); agy upgraded/renamed; project working directory deleted while cc-connect runs; run-as-user permission issues.

Related errors


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