Camoufox Tab Creation Kept Timing Out on Hermes
I'd send Hermes links to read. Reddit threads, a couple of docs sites, the occasional opinion piece. Half of them wouldn't load. Bot detection. Just blocked.
(Hermes is the local agent I use for reading and research. Pointing it at a URL and expecting it to come back with something useful was the whole idea.)
I didn't really know where to go with it until I stumbled on a thread in the Hermes subreddit about this exact problem. People recommended Camoufox, a Firefox fork with fingerprint spoofing built in, designed to look like a real browser to detection systems. I forwarded the thread to Hermes and said let's do this.
Setting Up Camoufox
Hermes took it from there. The thread pointed at a recommended architecture: a Node.js server called camofox-browser that wraps Camoufox and exposes a REST API, which Hermes has native support for. Hermes pulled it down, wired up the config, and started it.
Here's what it configured. In ~/.hermes/.env:
CAMOFOX_URL=http://localhost:9377
CAMOFOX_ADOPT_EXISTING_TAB=true
And in ~/.hermes/config.yaml under browser.camofox:
camofox:
managed_persistence: true
adopt_existing_tab: true
Health check came back clean. Looked done.
Tab Creation Kept Timing Out
It wasn't done. The first time Hermes tried to actually open a tab:
tab create timed out after 30000ms
browserContext.newPage: Target page, context or browser has been closed
The browser launched. It just wouldn't open tabs. I assumed it was a resources thing at first. Wrong direction.
So I asked Hermes to go digging. It traced it through the code — firefox.launch(options) was succeeding, but the IPC pipe (the juggler interface Playwright uses to talk to Firefox) was being blocked. Hermes grepped the camoufox package for sandbox-related flags and found nothing in the application code, which meant the problem was at the Firefox runtime level.
It was. Firefox's content sandbox, a security feature that isolates content processes, was sealing off that IPC pipe. The browser launches fine, but the moment it tries to sandbox its child content processes, the pipe gets closed and the tab request dies before it ever gets a page.
Two environment variables fixed it:
MOZ_DISABLE_CONTENT_SANDBOX=1
MOZ_ENABLE_WAYLAND=0
MOZ_DISABLE_CONTENT_SANDBOX=1 turns the content sandbox off, unblocking the pipe. MOZ_ENABLE_WAYLAND=0 forces Firefox onto X11 instead of Wayland — the sandbox behaviour was worse on Wayland, or the IPC just works more reliably over X11 for headless automation. Hermes set both in the same patch and restarted.
The health check came back with browserConnected: true and browserRunning: true. Tab creation worked. Felt anticlimactic after all that back and forth.
Making It Stick
The persistence instinct was familiar — I'd already containerised my Hermes profiles for basically the same reason. Hermes wrapped the camofox server in a user-level systemd service (~/.config/systemd/user/camofox.service) so it survives reboots, carrying both environment variables.
The [Service] block ends up looking like:
[Service]
Environment=MOZ_DISABLE_CONTENT_SANDBOX=1
Environment=MOZ_ENABLE_WAYLAND=0
Now it survives reboots.
What Works Now
Reddit loads cleanly now. That was the whole point.
Sessions persist too. Cookies survive restarts because managed_persistence keeps a browser profile on disk at ~/.camofox/profiles/. The browser is pre-warmed when the service starts, so the first navigation isn't sluggish. I notice it most on the cold first read of the day.
The core problem, Hermes flat-out refusing to load half the links I sent it, is mostly gone. A few sites still clock me occasionally, but it's the exception now rather than the default.