Appearance
Device pairing failed
Pairing fails in one of three ways:
- The CLI errors immediately — wrong cloud URL, bad flag, missing prerequisite.
- The CLI runs and seems to succeed, but the Device doesn't show up in the cloud's Devices list.
- The CLI hangs forever waiting for browser approval.
Triage
Failure 1: CLI errors immediately
Common error messages:
| Error | Cause | Fix |
|---|---|---|
MX CLI not found in HiveCast package | Wrapper bundle is incomplete | Re-build: pnpm --filter hivecast build |
getaddrinfo ENOTFOUND hivecast.ai | DNS / connectivity | Check network; can you curl https://hivecast.ai/healthz? |
certificate has expired | TLS issue with the cloud endpoint | Cloud-side problem; report it. For self-hosted: renew TLS cert |
Invalid setup code | The setup code is expired or wrong | Generate a fresh one from the cloud Devices page |
Failure 2: CLI succeeds but Device doesn't appear
Verify locally first:
bash
hivecast whoami --home <host-home>
hivecast link-status --home <host-home>If whoami says "not linked" but you got "success" output from login, something erased the link record. Check:
bash
ls -la <host-home>/credentials/hivecast-link.jsonIf missing — re-run pairing. If present:
bash
cat <host-home>/credentials/hivecast-link.json | jq .Look for:
hostId— should be setauthorityRoot— should match cloud's expected root for your principalcloud.url— should match the cloud you're trying to pair to
If the link is on disk but the cloud Devices list doesn't show it, the heartbeat isn't reaching the cloud. Check host.control runtime stderr:
bash
tail -100 <host-home>/logs/runtimes/RUNTIME-HOST-LOCAL-*-HOST-CONTROL.stderr.logCommon causes:
- Cloud
/_auth/host-link/heartbeatendpoint is rejecting the JWT (cloud-sidesystem-authissue). - Network blocks outbound to
hivecast.ai. - The Device's NATS leaf connection is failing — runtime errors will say
connection refusedagainst the cloud's WSS endpoint.
Failure 3: CLI hangs forever
Browser-pair flows wait for user approval. If you've approved but the CLI is still waiting:
bash
# Cancel the CLI (Ctrl-C)
# Then check the link record
ls -la <host-home>/credentials/hivecast-link.jsonIf the link wrote successfully, the CLI just got stuck in a polling loop without seeing the approval. The link is real; you can Ctrl-C. Verify with hivecast whoami.
If the link didn't write, the cloud-side approval flow didn't complete on its end. Most common cause: you signed into the wrong account in the browser, or you closed the approval tab too early.
For the device-code form (setup-code path):
bash
hivecast login --setup-code <code> --cloud https://hivecast.ai --home <host-home>…the code expires after ~10 minutes. After that, the cloud rejects the redemption. Generate a fresh code.
Verifying the cloud is reachable
bash
curl -fsS https://hivecast.ai/healthz
curl -fsS https://hivecast.ai/.well-known/hivecast/versionShould both return 2xx. If they fail, the cloud is the problem, not your Device.
"Wrong principal / wrong Space"
If you successfully paired but to the wrong account or wrong Space:
bash
hivecast logout --revoke-cloud-link --home <host-home>
# Then re-pair to the right one
hivecast login --device --cloud https://hivecast.ai --route-key correct-space-path --home <host-home>logout --revoke-cloud-link is important — without it, the cloud will keep showing this Device as linked to the previous principal/Space until heartbeat goes stale.
"I want to pair to a self-hosted cloud, not hivecast.ai"
The --cloud flag accepts any HiveCast-shaped endpoint. The endpoint must:
- serve
/_auth/host-link/start(begin enrollment) - serve
/_auth/host-link/redeem(accept device-code redemption) - serve
/_auth/host-link/heartbeat(accept ongoing heartbeats) - have OAuth provider credentials configured if browser-pair is required
If pairing fails against a self-hosted cloud, check the cloud-side system-auth and system-gateway-http runtime logs.
"Pairing succeeded but auth.mode: 'public-session' on the local Host"
If the local Host is in public-session mode (target is for cloud-platform Hosts only), pairing semantics are different — the Host plays the cloud role itself. This is unusual; for normal Devices, ensure host.json has auth.mode: 'local-client'.
"I can't tell if pairing went through"
Run hivecast doctor --cloud https://hivecast.ai --home <host-home>. The cloud-aware variant runs additional checks: cloud reachability, Google login redirect, OAuth state persistence (per runHostDoctor in hivecast.mjs:1031-1187). If any of these fail, the pairing path can't work.
When all else fails
Capture diagnostics and file an issue:
bash
hivecast doctor --json --cloud https://hivecast.ai --home <host-home> > /tmp/doctor.json
tail -200 <host-home>/logs/runtimes/RUNTIME-HOST-LOCAL-*-HOST-CONTROL.stderr.log > /tmp/host-control.logSee Collect diagnostics for a more thorough capture.
See also
- Cloud Account → Login — the browser-side sign-in flow.
- Cloud Account → Device pairing — the full ceremony.
- CLI → hivecast login / whoami / logout.
- Quickstart → Login / pair a device.
Source:
projects/matrix-3/packages/hivecast/bin/hivecast.mjslines 1595-1635 (runHiveCastLinkCommandflow), 1031-1187 (runHostDoctorcloud checks);WORKSTREAMS/product-launch/HIVECAST-DEVICE-ENROLLMENT-SPEC.md.