{"record":{"id":"218cd8aed6faa52a","repo":"multica-ai/multica","slug":"at-least-one-repository-url-is-required","errorCode":null,"errorMessage":"at least one repository URL is required","messagePattern":"at least one repository URL is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/cmd/multica/cmd_repo.go","lineNumber":103,"sourceCode":"\tName  string          `json:\"name\"`\n\tSlug  string          `json:\"slug\"`\n\tRepos []workspaceRepo `json:\"repos\"`\n}\n\ntype repoMutationResult struct {\n\tWorkspaceID string          `json:\"workspace_id\"`\n\tAdded       []workspaceRepo `json:\"added,omitempty\"`\n\tUpdated     []workspaceRepo `json:\"updated,omitempty\"`\n\tRemoved     []workspaceRepo `json:\"removed,omitempty\"`\n\tRepos       []workspaceRepo `json:\"repos\"`\n}\n\nfunc repoURLsFromArgsAndFlags(cmd *cobra.Command, args []string) ([]string, error) {\n\tflagURLs, _ := cmd.Flags().GetStringArray(\"url\")\n\traw := append([]string{}, flagURLs...)\n\traw = append(raw, args...)\n\tif len(raw) == 0 {\n\t\treturn nil, fmt.Errorf(\"at least one repository URL is required\")\n\t}\n\n\turls := make([]string, 0, len(raw))\n\tseen := make(map[string]struct{}, len(raw))\n\tfor _, u := range raw {\n\t\tu = strings.TrimSpace(u)\n\t\tif u == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"repository URL cannot be empty\")\n\t\t}\n\t\tif _, ok := seen[u]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tseen[u] = struct{}{}\n\t\turls = append(urls, u)\n\t}\n\treturn urls, nil\n}\n","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_repo.go#L85-L121","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Pass URLs positionally (`multica repo add https://github.com/o/r`) or via one or more `--url` flags.","In scripts, fail fast when the generated URL list is empty instead of invoking the CLI.","Both sources are merged and de-duplicated, so mixing args and `--url` is fine."],"exampleFix":"# before\nmultica repo add\n# error: at least one repository URL is required\n\n# after\nmultica repo add https://github.com/acme/api --url https://github.com/acme/web","handlingStrategy":"validation","validationCode":"# bash: fail fast when the generated repo list is empty\n[ \"${#REPOS[@]}\" -gt 0 ] || { echo 'no repository URLs supplied' >&2; exit 1; }\nmultica repo add \"${REPOS[@]}\"","typeGuard":"func hasRepoURLs(flagURLs []string, args []string) bool {\n    return len(flagURLs)+len(args) > 0\n}","tryCatchPattern":null,"preventionTips":["Pass URLs positionally or via repeated --url flags; both are merged and de-duplicated.","Validate generated URL lists are non-empty before shelling out."],"tags":["go","cli","validation","repo","flags"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}