multica-ai/multica · warning

--description can only be used when adding one repository UR

Error message

--description can only be used when adding one repository URL

What it means

Pure CLI argument validation in runRepoAdd: the --description flag is only meaningful when a single repository URL is supplied. If the flag was explicitly set (--description or -d on the command line, detected via cmd.Flags().Changed) and more than one URL argument/flag value resolved, the command aborts before contacting the server.

Source

Thrown at server/cmd/multica/cmd_repo.go:194

		return nil
	}
	rows := make([][]string, 0, len(ws.Repos))
	for _, repo := range ws.Repos {
		rows = append(rows, []string{repo.URL, repo.Description})
	}
	cli.PrintTable(os.Stdout, []string{"URL", "DESCRIPTION"}, rows)
	return nil
}

func runRepoAdd(cmd *cobra.Command, args []string) error {
	urls, err := repoURLsFromArgsAndFlags(cmd, args)
	if err != nil {
		return err
	}
	description, _ := cmd.Flags().GetString("description")
	descriptionChanged := cmd.Flags().Changed("description")
	if descriptionChanged && len(urls) > 1 {
		return fmt.Errorf("--description can only be used when adding one repository URL")
	}

	client, workspaceID, err := repoCommandClient(cmd)
	if err != nil {
		return err
	}

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

	ws, err := fetchRepoWorkspace(ctx, client, workspaceID)
	if err != nil {
		return err
	}

	indexByURL := make(map[string]int, len(ws.Repos))
	for i, repo := range ws.Repos {
		indexByURL[repo.URL] = i

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Drop --description and run the add for multiple URLs, then set descriptions individually afterwards (re-add the single URL with --description, or edit via the API/UI).
  2. Split into two invocations: one per URL, each with its own --description.
  3. If all repos need the same description, loop in shell: for u in "$@"; do multica repo add "$u" --description "$d"; done.

Example fix

# before
multica repo add https://a.git https://b.git --description "services"

# after
multica repo add https://a.git --description "service a"
multica repo add https://b.git --description "service b"
Defensive patterns

Strategy: validation

Validate before calling

# shell guard before invoking the CLI
if [ $# -gt 1 ] && [ -n "$DESCRIPTION" ]; then
  echo "--description only valid for a single URL" >&2; exit 2
fi

Prevention

When it happens

Trigger: Running `multica repo add URL1 URL2 --description "text"`, or using --url/--file-style inputs (repoURLsFromArgsAndFlags) that expand to multiple URLs together with an explicitly passed --description.

Common situations: Shell scripts written for the single-URL case later extended with multiple URLs while the --description flag remained; passing an empty string via --description "" (still counts as Changed) while adding a batch.

Related errors


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