Skip to content

Conversation

@aronchick
Copy link

@aronchick aronchick commented Feb 7, 2026

Problem

On headless Linux servers without xdg-open, clawhub login crashes with:

Error: spawn xdg-open ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:285:19)

This affects:

  • VPS/cloud servers
  • Docker containers
  • CI environments
  • WSL without browser integration

Solution

Catch the ENOENT error and gracefully print the URL for manual copy-paste instead of crashing.

Changes

  • packages/clawdhub/src/cli/ui.ts: Add error handler to openInBrowser()

Testing

Tested on Ubuntu VPS without xdg-open installed:

Before: Crash with ENOENT
After: Prints URL with instructions to open manually

Greptile Overview

Greptile Summary

This PR updates the CLI openInBrowser() helper to handle environments where the platform opener binary (notably xdg-open on headless Linux) is missing. It adds a child.on('error', …) handler and, when the spawn fails with ENOENT, prints the URL and instructions for manual copy/paste instead of crashing.

The change is localized to packages/clawdhub/src/cli/ui.ts and affects the login flow (and any other CLI path that calls openInBrowser) by making browser-opening best-effort rather than a hard failure when the opener executable is not present.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • The change is small and localized: it adds an 'error' event handler to the spawned opener process and only changes behavior in the specific failure case (missing opener binary, ENOENT) by printing a manual URL instead of crashing. No API surface changes and no control-flow changes outside the error path.
  • No files require special attention

(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!

On headless Linux servers without xdg-open, 'clawhub login' crashes with
ENOENT error. This change catches the error and prints the URL for manual
copy-paste instead of crashing.

Fixes crash on:
- VPS/cloud servers
- Docker containers
- CI environments
- WSL without browser integration
@vercel
Copy link
Contributor

vercel bot commented Feb 7, 2026

@aronchick is attempting to deploy a commit to the Amantus Machina Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant