multica-ai/multica · warning

at least one repository URL is required

Error message

at least one repository URL is required

What it means

Returned by `repoURLsFromArgsAndFlags` when neither positional arguments nor `--url` flags supplied any repository URL. The repo subcommands require at least one URL to act on, so the invocation is rejected before any API call.

Source

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

	Name  string          `json:"name"`
	Slug  string          `json:"slug"`
	Repos []workspaceRepo `json:"repos"`
}

type repoMutationResult struct {
	WorkspaceID string          `json:"workspace_id"`
	Added       []workspaceRepo `json:"added,omitempty"`
	Updated     []workspaceRepo `json:"updated,omitempty"`
	Removed     []workspaceRepo `json:"removed,omitempty"`
	Repos       []workspaceRepo `json:"repos"`
}

func repoURLsFromArgsAndFlags(cmd *cobra.Command, args []string) ([]string, error) {
	flagURLs, _ := cmd.Flags().GetStringArray("url")
	raw := append([]string{}, flagURLs...)
	raw = append(raw, args...)
	if len(raw) == 0 {
		return nil, fmt.Errorf("at least one repository URL is required")
	}

	urls := make([]string, 0, len(raw))
	seen := make(map[string]struct{}, len(raw))
	for _, u := range raw {
		u = strings.TrimSpace(u)
		if u == "" {
			return nil, fmt.Errorf("repository URL cannot be empty")
		}
		if _, ok := seen[u]; ok {
			continue
		}
		seen[u] = struct{}{}
		urls = append(urls, u)
	}
	return urls, nil
}

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Pass URLs positionally (`multica repo add https://github.com/o/r`) or via one or more `--url` flags.
  2. In scripts, fail fast when the generated URL list is empty instead of invoking the CLI.
  3. Both sources are merged and de-duplicated, so mixing args and `--url` is fine.

Example fix

# before
multica repo add
# error: at least one repository URL is required

# after
multica repo add https://github.com/acme/api --url https://github.com/acme/web
Defensive patterns

Strategy: validation

Validate before calling

# bash: fail fast when the generated repo list is empty
[ "${#REPOS[@]}" -gt 0 ] || { echo 'no repository URLs supplied' >&2; exit 1; }
multica repo add "${REPOS[@]}"

Type guard

func hasRepoURLs(flagURLs []string, args []string) bool {
    return len(flagURLs)+len(args) > 0
}

Prevention

When it happens

Trigger: Running a repo add/sync-style command with no args and no `--url`, e.g. `multica repo add` alone, or when a script's URL list variable expands to nothing.

Common situations: Forgetting the URL entirely; CI jobs where the repo list is generated and the generator returned zero entries; misreading the command signature (assuming it reads from stdin or config).

Related errors


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