Skip to main content

Termux/Android Argv Duplication

Getting unknown command "expanso-edge" errors when running the edge agent on Termux or Android? This is caused by the platform's exec wrapper duplicating the binary name as the first argument.

The error message includes a hint when this pattern is detected:

Error: unknown command "expanso-edge"

Hint: It looks like the binary name "expanso-edge" was passed as an argument.
This can happen with Termux or Android exec wrappers that duplicate argv[0].
Try running with explicit arguments: expanso-edge run
Or set args after the binary: expanso-edge -- run

Why This Happens

Some Android and Termux exec wrappers inject the binary name as an extra argument when launching programs. When you run:

expanso-edge run

The system might actually execute it as:

expanso-edge expanso-edge run

This causes the CLI to interpret expanso-edge as an unknown command instead of the run subcommand.

Solutions

Option 1: Use explicit argument separator

Add -- between the binary name and your arguments:

expanso-edge -- run
expanso-edge -- bootstrap --token YOUR_TOKEN

Best for: Most users on affected platforms.

Option 2: Create a wrapper script

Create a shell script that handles the argument passing correctly:

#!/bin/sh
exec /path/to/expanso-edge -- "$@"

Save this as expanso-edge-wrapper and use it instead of calling the binary directly.

Best for: Permanent fix without changing your workflow.

Option 3: Use environment-specific workarounds

Some Termux configurations allow you to disable the exec wrapper behavior. Check your Termux settings or consult the Termux documentation for environment-specific options.

Affected Platforms

This issue can occur on Termux, Android systems with custom exec wrappers, and some emulated Android environments. Standard Linux, macOS, and Windows installations are not affected.