multica-ai/multica · error
token is required
Error message
token is required
What it means
Token login reached the point where the token string is still empty after trimming the provided value and (if prompted) the entered line. An explicitly empty token is rejected before any validation or network call.
Source
Thrown at server/cmd/multica/cmd_auth.go:430
func runAuthLoginToken(cmd *cobra.Command, providedToken string) error {
// The prompt sentinel is what pflag substitutes for `--token` with no
// value (see loginCmd init); treat it the same as an empty string so we
// fall through to the interactive prompt.
if providedToken == tokenPromptSentinel {
providedToken = ""
}
token := strings.TrimSpace(providedToken)
if token == "" {
fmt.Print("Enter your personal access token: ")
scanner := bufio.NewScanner(os.Stdin)
if !scanner.Scan() {
return fmt.Errorf("no input")
}
token = strings.TrimSpace(scanner.Text())
}
if token == "" {
return fmt.Errorf("token is required")
}
if err := validateLoginTokenPrefix(token); err != nil {
return err
}
serverURL := resolveLoginTokenServerURL(cmd)
client := cli.NewAPIClient(serverURL, "", token)
ctx, cancel := cli.APIContext(context.Background())
defer cancel()
var me struct {
Name string `json:"name"`
Email string `json:"email"`
}
if err := client.GetJSON(ctx, "/api/me", &me); err != nil {
return cli.WithUserMessage("Could not sign in with that token — make sure it is valid and not expired, then run `multica login --token <token>` again.", err)
}View on GitHub (pinned to 2c0912b6ec)
Solutions
- Enter or pass a real PAT beginning with mul_ (or the cloud PAT prefix)
- In scripts, guard before invoking: fail fast if $MULTICA_TOKEN is empty
- Re-copy the token and paste again at the prompt
Example fix
# shell guard before login
[ -n "$MULTICA_TOKEN" ] || { echo 'MULTICA_TOKEN is empty' >&2; exit 1; }
multica login --token "$MULTICA_TOKEN" Defensive patterns
Strategy: validation
Validate before calling
[ -n "$(trim "$MULTICA_TOKEN")" ] || { echo 'token is empty' >&2; exit 1; } Prevention
- Fail fast in scripts when the token variable is unset or empty
- Confirm the paste actually landed at the prompt before pressing Enter
When it happens
Trigger: Pressing Enter at the token prompt without typing anything; passing `--token ''` or `--token` with only whitespace; the sentinel value for valueless --token plus an empty stdin line.
Common situations: Users unsure whether the prompt is pre-filled and pressing Enter; scripts passing an unset environment variable that expands to empty; copy failures leaving the clipboard empty.
Related errors
- invalid token format: must start with %s
- could not start the local login callback server (used to rec
- failed to generate state: %w
- local server error: %w
- timed out waiting for authentication
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/4bf44884443f8080.
Report an issue: GitHub.