multica-ai/multica · error
failed to save config: %w
Error message
failed to save config: %w
What it means
After a successful browser login the CLI writes the updated profile config (new PAT token, server/app URLs, workspace reset) via SaveCLIConfigForProfile. This error wraps any failure persisting that file, meaning login succeeded server-side but the credential was not saved locally.
Source
Thrown at server/cmd/multica/cmd_auth.go:356
patClient := cli.NewAPIClient(serverURL, "", patResp.Token)
var me struct {
Name string `json:"name"`
Email string `json:"email"`
}
if err := patClient.GetJSON(ctx, "/api/me", &me); err != nil {
return cli.WithUserMessage("Sign-in did not complete: the server did not accept the new credential. Run `multica login` again.", err)
}
// Save to config. Reset workspace data on every login — the user or
// server may have changed, so stale workspaces must not persist.
profile := resolveProfile(cmd)
cfg, _ := cli.LoadCLIConfigForProfile(profile)
cfg.WorkspaceID = ""
cfg.Token = patResp.Token
cfg.ServerURL = serverURL
cfg.AppURL = appURL
if err := cli.SaveCLIConfigForProfile(cfg, profile); err != nil {
return fmt.Errorf("failed to save config: %w", err)
}
fmt.Fprintf(os.Stderr, "Authenticated as %s (%s)\nToken saved to config.\n", me.Name, me.Email)
return nil
}
func runningInSSHSession() bool {
for _, key := range []string{"SSH_CONNECTION", "SSH_CLIENT", "SSH_TTY"} {
if strings.TrimSpace(os.Getenv(key)) != "" {
return true
}
}
return false
}
func callbackHostFlagValue(cmd *cobra.Command) string {
for c := cmd; c != nil; c = c.Parent() {
if value := nonEmptyFlagValue(c.Flags(), callbackHostFlag); value != "" {View on GitHub (pinned to 2c0912b6ec)
Solutions
- Check and fix permissions on the profile config directory (e.g. ~/.config/multica or the XDG path) — ensure it is writable by the current user
- Free disk space if the volume is full
- If a file exists where the config directory should be, remove/rename it
- After fixing, rerun `multica login` (the server-side PAT may already exist; re-login is harmless)
Example fix
# diagnose and fix ls -la ~/.config/multica 2>/dev/null || echo 'missing' mkdir -p ~/.config/multica && chmod u+w ~/.config/multica multica login
Defensive patterns
Strategy: validation
Validate before calling
# verify the config dir is writable before login
cfgdir="${XDG_CONFIG_HOME:-$HOME/.config}/multica"
mkdir -p "$cfgdir" && [ -w "$cfgdir" ] || { echo "config dir not writable: $cfgdir" >&2; exit 1; } Prevention
- Provision and permission the config directory during environment setup, before first login
- Check disk space before login on space-constrained VMs
When it happens
Trigger: Config directory not writable (permissions, read-only home); disk full; XDG/config path resolving to a file instead of a directory; SELinux/AppArmor denying writes to the config path.
Common situations: Running the CLI as a different user than the one who owns ~/.config; shared/locked-down machines; containers with read-only home; home quota exceeded.
Related errors
- 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
- no input
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/fc701f56d16ff3b2.
Report an issue: GitHub.