{"record":{"id":"424111f48b073da6","repo":"multica-ai/multica","slug":"description-can-only-be-used-when-adding-one-rep","errorCode":null,"errorMessage":"--description can only be used when adding one repository URL","messagePattern":"--description can only be used when adding one repository URL","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/cmd/multica/cmd_repo.go","lineNumber":194,"sourceCode":"\t\treturn nil\n\t}\n\trows := make([][]string, 0, len(ws.Repos))\n\tfor _, repo := range ws.Repos {\n\t\trows = append(rows, []string{repo.URL, repo.Description})\n\t}\n\tcli.PrintTable(os.Stdout, []string{\"URL\", \"DESCRIPTION\"}, rows)\n\treturn nil\n}\n\nfunc runRepoAdd(cmd *cobra.Command, args []string) error {\n\turls, err := repoURLsFromArgsAndFlags(cmd, args)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdescription, _ := cmd.Flags().GetString(\"description\")\n\tdescriptionChanged := cmd.Flags().Changed(\"description\")\n\tif descriptionChanged && len(urls) > 1 {\n\t\treturn fmt.Errorf(\"--description can only be used when adding one repository URL\")\n\t}\n\n\tclient, workspaceID, err := repoCommandClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()\n\n\tws, err := fetchRepoWorkspace(ctx, client, workspaceID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tindexByURL := make(map[string]int, len(ws.Repos))\n\tfor i, repo := range ws.Repos {\n\t\tindexByURL[repo.URL] = i","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_repo.go#L176-L212","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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).","Split into two invocations: one per URL, each with its own --description.","If all repos need the same description, loop in shell: for u in \"$@\"; do multica repo add \"$u\" --description \"$d\"; done."],"exampleFix":"# before\nmultica repo add https://a.git https://b.git --description \"services\"\n\n# after\nmultica repo add https://a.git --description \"service a\"\nmultica repo add https://b.git --description \"service b\"","handlingStrategy":"validation","validationCode":"# shell guard before invoking the CLI\nif [ $# -gt 1 ] && [ -n \"$DESCRIPTION\" ]; then\n  echo \"--description only valid for a single URL\" >&2; exit 2\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Batch adds and per-repo descriptions are mutually exclusive by design — split invocations.","Remember --description \"\" still counts as 'changed' and triggers the guard.","Wrap batch logic in a loop of single-URL adds when descriptions differ."],"tags":["go","cli","flag-validation","cobra","usage-error"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}