multica-ai/multica · error
not authenticated: run 'multica login' first%s
Error message
not authenticated: run 'multica login' first%s
What it means
Shared helper fetchWorkspaces (used by `workspace list` and `workspace switch`) found no auth token: resolveToken returned an empty string for both the flag/env and stored credential. The suffix from daemonPortOnlyContextHint adds context when only a daemon port mismatch is involved.
Source
Thrown at server/cmd/multica/cmd_workspace.go:229
}
// workspaceSummary is the subset of fields the CLI needs from /api/workspaces
// to drive list and switch. Keeping it here (instead of using the full
// WorkspaceResponse) avoids a dependency on the handler package.
type workspaceSummary struct {
ID string `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
}
// fetchWorkspaces lists all workspaces the authenticated user belongs to. It
// is shared by `list` and `switch` so both see the same access-controlled view
// of workspaces.
func fetchWorkspaces(ctx context.Context, cmd *cobra.Command) ([]workspaceSummary, error) {
serverURL := resolveServerURL(cmd)
token := resolveToken(cmd)
if token == "" {
return nil, fmt.Errorf("not authenticated: run 'multica login' first%s", daemonPortOnlyContextHint())
}
client := cli.NewAPIClient(serverURL, "", token)
var workspaces []workspaceSummary
if err := client.GetJSON(ctx, "/api/workspaces", &workspaces); err != nil {
return nil, fmt.Errorf("list workspaces: %w", err)
}
return workspaces, nil
}
func runWorkspaceList(cmd *cobra.Command, _ []string) error {
ctx, cancel := cli.APIContext(context.Background())
defer cancel()
workspaces, err := fetchWorkspaces(ctx, cmd)
if err != nil {
return err
}View on GitHub (pinned to 2c0912b6ec)
Solutions
- Run `multica login` to obtain and store a token.
- If scripting/CI, supply the token explicitly via the token flag or environment variable instead of relying on the store.
- If you already logged in, verify the credential file exists and is readable by the current OS user (no permission errors in `multica login` output).
Example fix
# before multica workspace list # not authenticated # after multica login && multica workspace list
Defensive patterns
Strategy: validation
Validate before calling
command -v multica >/dev/null && multica login --check 2>/dev/null || echo 'no stored token; run multica login'
Prevention
- Run `multica login` as the first step of any scripted session.
- In CI, inject the token via env/flag rather than relying on the credential store.
- Confirm the credential file's user/permissions after OS user changes.
When it happens
Trigger: Running `multica workspace list` or `workspace switch` before ever running `multica login`, or after the stored token file was removed, with no --token flag / MULTICA_TOKEN-style env override.
Common situations: Fresh installs, CI containers with no credential store, home-dir permission issues that silently prevent token persistence, or multiple profiles where login was done under a different user.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- list workspaces: %w
- create workspace: %w
- get source agent: %w
- invalid token format: must start with %s
- unsupported platform: %s
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/3715ecbada14d92a.
Report an issue: GitHub.