multica-ai/multica · error

not authenticated

Error message

not authenticated

What it means

Thrown by autoWatchWorkspaces after `multica login` when the freshly saved profile config has an empty token. The function deliberately loads the exact profile via LoadCLIConfigForProfile (not the task-safe resolvers) and fails closed if authentication state is missing, aborting the post-login workspace auto-watch step.

Solutions

  1. Inspect the profile config file for the active profile and confirm the token field is populated
  2. Verify write permissions on the CLI config directory; fix the filesystem issue and re-run `multica login`
  3. Ensure --profile matches the profile you authenticated against
  4. Re-run `multica login` after correcting the environment
Defensive patterns

Strategy: validation

Validate before calling

# bash: confirm the profile config actually holds a token after login
multica config show --output json 2>/dev/null | jq -e '.token | length > 0' >/dev/null \
  || { echo "login did not persist a token — check config dir permissions" >&2; exit 2; }

Prevention

When it happens

Trigger: Login flow completes but the token fails to persist to the profile config file; the config file is unreadable/corrupted in a way that yields an empty Token; a profile flag pointing at a profile that was never actually written; filesystem permissions blocking the config write.

Common situations: Home or config directory read-only (containers, restricted CI); XDG/config path misconfiguration; concurrent logins overwriting the profile; auth backend returning success without a token.

Understand the failure class

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/7841c34d940e3462. Report an issue: GitHub.

Appendix: source

Thrown at server/cmd/multica/cmd_login.go:97

		return nil
	}

	fmt.Fprintf(os.Stderr, "\n→ Run 'multica daemon start' to start your local agent runtime.\n")
	return nil
}

func autoWatchWorkspaces(cmd *cobra.Command) error {
	// runLogin has already passed the human/local command guard and saved the
	// newly authenticated profile. Read that exact profile here rather than the
	// general task-safe resolvers, which intentionally fail closed on a lone
	// MULTICA_DAEMON_PORT signal.
	profile := resolveProfile(cmd)
	cfg, err := cli.LoadCLIConfigForProfile(profile)
	if err != nil {
		return err
	}
	if cfg.Token == "" {
		return fmt.Errorf("not authenticated")
	}
	if cfg.ServerURL == "" {
		return fmt.Errorf("server URL not configured")
	}

	client := cli.NewAPIClient(normalizeAPIBaseURL(cfg.ServerURL), "", cfg.Token)
	ctx, cancel := cli.APIContext(context.Background())
	defer cancel()

	var workspaces []struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	}
	if err := client.GetJSON(ctx, "/api/workspaces", &workspaces); err != nil {
		return fmt.Errorf("list workspaces: %w", err)
	}

	if len(workspaces) == 0 {

View on GitHub (pinned to 2c0912b6ec)