multica-ai/multica · error
timed out waiting for authentication
Error message
timed out waiting for authentication
What it means
Browser login waits on a select with a 5-minute time.After for the JWT to arrive via the local callback. If nothing completes the flow in that window (user never signed in, browser never opened, callback never reached the listener), the command times out.
Source
Thrown at server/cmd/multica/cmd_auth.go:310
}
}()
defer srv.Close()
// Open the browser.
fmt.Fprintln(os.Stderr, "Opening browser to authenticate...")
if err := openBrowser(loginURL); err != nil {
fmt.Fprintf(os.Stderr, "Could not open browser automatically.\n")
}
fmt.Fprint(os.Stderr, browserLoginInstructions(loginURL, callbackHost, port, runningInSSHSession()))
// Wait for the JWT from the callback (timeout 5 minutes).
var jwtToken string
select {
case jwtToken = <-jwtCh:
case err := <-errCh:
return fmt.Errorf("local server error: %w", err)
case <-time.After(5 * time.Minute):
return fmt.Errorf("timed out waiting for authentication")
}
// Use the JWT to create a PAT via the existing API.
client := cli.NewAPIClient(serverURL, "", jwtToken)
ctx, cancel := cli.APIContext(context.Background())
defer cancel()
hostname, _ := os.Hostname()
if hostname == "" {
hostname = "unknown"
}
patName := fmt.Sprintf("CLI (%s)", hostname)
expiresInDays := 90
var patResp struct {
Token string `json:"token"`
}View on GitHub (pinned to 2c0912b6ec)
Solutions
- Rerun login and complete the browser sign-in promptly; copy the printed URL manually if the browser did not open
- Ensure the browser and the CLI run on the same host (or that the callback host is reachable from the browser)
- For SSH sessions, use the printed remote-friendly instructions or switch to token login
- Use `multica login --token <PAT>` to bypass the browser flow entirely
Defensive patterns
Strategy: validation
Validate before calling
# headless/SSH detection: choose token login up front [ -n "$SSH_CONNECTION" ] && [ -z "$DISPLAY" ] && use_token_login=1
Prevention
- In automation always use --token login, never the browser flow
- Complete browser sign-in within the 5-minute window or rerun
When it happens
Trigger: User stepped away; browser failed to open (headless/SSH) and the printed URL was not used; sign-in page opened but never finished; callback blocked from reaching localhost (browser in a remote desktop/VM while CLI runs elsewhere).
Common situations: SSH/remote sessions where the browser opens on another machine than the listener; slow SSO flows exceeding 5 minutes; forgotten terminal after kicking off login.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- local server error: %w
- unsupported platform: %s
- could not start the local login callback server (used to rec
- failed to generate state: %w
- failed to save config: %w
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/9b777ac098f4b2ea.
Report an issue: GitHub.