multica-ai/multica · warning
repository URL cannot be empty
Error message
repository URL cannot be empty
What it means
Returned by `repoURLsFromArgsAndFlags` when a supplied repository URL trims to an empty string (`strings.TrimSpace(u) == ""`). Unlike the 'at least one' check, this fires when a URL slot exists but its content is blank — including whitespace-only values.
Source
Thrown at server/cmd/multica/cmd_repo.go:111
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
}
func fetchRepoWorkspace(ctx context.Context, client *cli.APIClient, workspaceID string) (repoWorkspaceResponse, error) {
var ws repoWorkspaceResponse
if err := client.GetJSON(ctx, "/api/workspaces/"+workspaceID, &ws); err != nil {
return repoWorkspaceResponse{}, fmt.Errorf("get workspace: %w", err)
}
if ws.Repos == nil {
ws.Repos = []workspaceRepo{}
}View on GitHub (pinned to 2c0912b6ec)
Solutions
- Remove empty/whitespace entries from the arguments or `--url` flags.
- Filter the list in the calling script: `URLS=$(grep -v '^[[:space:]]*$' repos.txt`).
- Validate each URL is non-empty and starts with the expected scheme (https://) before invoking the CLI.
Example fix
# before
REPOS=("" "https://github.com/acme/api")
for r in "${REPOS[@]}"; do multica repo add "$r"; done
# error: repository URL cannot be empty
# after
for r in "${REPOS[@]}"; do [ -z "$(printf '%s' "$r" | tr -d '[:space:]')" ] && continue; multica repo add "$r"; done Defensive patterns
Strategy: validation
Validate before calling
# bash: strip empty/whitespace entries before invoking
mapfile -t REPOS < <(grep -v '^[[:space:]]*$' repos.txt)
multica repo add "${REPOS[@]}" Type guard
func isNonEmptyURL(u string) bool { return strings.TrimSpace(u) != "" } Prevention
- Trim whitespace and drop empty elements from URL arrays before passing them.
- A quoted empty variable (`"$EMPTY"`) still produces an empty argument — check before quoting.
When it happens
Trigger: Passing `--url ""`, `--url " "`, or an empty positional arg (common with quoted empty shell variables or trailing spaces in generated lists).
Common situations: Scripts looping over a repo array that contains an empty element (`for r in "${REPOS[@]}"` with an empty entry); copy-paste leaving a stray `''` argument; whitespace artifacts from file reads.
Related errors
- at least one repository URL is required
- invalid direction %q (want \"up\" or \"down\")
- --name is required
- --runtime-id is required
- --runtime-config must be valid JSON: %w
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/f77f763c3f515ed9.
Report an issue: GitHub.