---
name: browser-infrastructure-recovery
description: Troubleshooting and restoring the Camofox headless browser server when web toolsets fail.
---

# Browser Infrastructure Recovery

This skill is used when `browser_navigate` or other web-based tools return connection errors (e.g., "Cannot connect to Camofox at http://localhost:9377").

## When to Use
- Browser tools return connection refused or timeout errors.
- Sub-agents fail to retrieve real-time data despite having the `web` toolset enabled.
- System reports a failure to connect to the browser engine at `localhost:9377`.

## Recovery Workflow

### 1. Verify Process State
Check if the browser server is running:
- Run `ps aux | grep camofox` or `netstat -tulpen | grep 9377` to see if the port is active.
- If no process is found, the server is down.

### 2. Locate Installation
The browser server is typically located in the home directory:
- Path: `~/camofox-browser`

### 3. Restart Server
Launch the server in the background to ensure persistence:
- **Command:** `cd ~/camofox-browser && npm start`
- **Execution:** Use `terminal(background=true, ...)` to keep the server alive across turns.

### 4. Connectivity Test
Verify the fix by performing a simple navigation:
- **Test:** `browser_navigate(url="https://www.google.com")`
- **Success Criteria:** Return of a page snapshot with element refs.

## Pitfalls & Troubleshooting
- **Port Conflicts:** If `npm start` fails, check if another process is occupying port 9377.
- **Sudo Requirements:** If the server fails to start due to permission issues, use `sudo` (requires user password).
- **Zombie Processes:** If the server is "running" but unresponsive, kill all node processes related to camofox before restarting.
