multica-ai/multica · error

get user profile: %w

Error message

get user profile: %w

What it means

The `multica user profile get` command failed its GET /api/me request through the shared API client. The wrapped error identifies whether this is transport-level (server unreachable, bad server URL) or HTTP-level (401 expired token, 5xx), since the client prefixes those differently.

Source

Thrown at server/cmd/multica/cmd_user.go:78

	userProfileUpdateCmd.Flags().Bool("description-stdin", false, "Read description from stdin (preserves multi-line content verbatim)")
	userProfileUpdateCmd.Flags().String("description-file", "", "Read description from a UTF-8 file (preserves multi-line content verbatim; use this on Windows when stdin piping mangles non-ASCII bytes). The path must be inside the current working directory unless --allow-external-file is set.")
	userProfileUpdateCmd.Flags().Bool("allow-external-file", false, "Allow --description-file to read a path outside the current working directory. Off by default so a stale temp file from another run/environment can't be picked up (MUL-4252).")
	userProfileUpdateCmd.Flags().Bool("clear", false, "Clear the profile description (equivalent to --description \"\")")
	userProfileUpdateCmd.Flags().String("output", "table", "Output format: table or json")
}

func runUserProfileGet(cmd *cobra.Command, _ []string) error {
	client, err := newAPIClient(cmd)
	if err != nil {
		return err
	}

	ctx, cancel := cli.APIContext(context.Background())
	defer cancel()

	var me map[string]any
	if err := client.GetJSON(ctx, "/api/me", &me); err != nil {
		return fmt.Errorf("get user profile: %w", err)
	}

	output, _ := cmd.Flags().GetString("output")
	if output == "json" {
		return cli.PrintJSON(os.Stdout, me)
	}

	printUserProfileTable(os.Stdout, me)
	return nil
}

func runUserProfileUpdate(cmd *cobra.Command, _ []string) error {
	// `--clear` is its own flag (not "pass an empty string") because cobra's
	// default value for a Changed("") flag would otherwise be ambiguous with
	// "user typed `--description ""`". Keep both forms supported — the inline
	// empty string is what someone scripting bash would reach for.
	clearFlag, _ := cmd.Flags().GetBool("clear")
	desc, hasDesc, err := resolveTextFlag(cmd, "description")

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Confirm the server is up: `multica status` or curl the /api/me endpoint of the resolved server URL.
  2. If the wrapped error mentions 401/unauthorized, re-authenticate with `multica login`.
  3. Verify --server / server env resolves to the intended instance (see daemonPortOnlyContextHint output elsewhere for port mismatches).
  4. Retry after the server reports healthy; treat 5xx as transient.
Defensive patterns

Strategy: try-catch

Validate before calling

multica status >/dev/null 2>&1 || { echo 'server not reachable'; exit 1; }

Try / catch

out=$(multica user profile get --output json 2>&1) || { case "$out" in *unauthorized*|*401*) multica login ;; *) echo "$out"; exit 1 ;; esac; }

Prevention

When it happens

Trigger: Running `multica user profile get` when the daemon/server at the resolved URL is not running, the stored auth token is expired/revoked (401), or a proxy in between mangles the request.

Common situations: Server not started yet in local dev, stale token after a server DB reset or re-login elsewhere, wrong --server flag or MULTICA_SERVER env pointing at an old port.

Related errors


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