{"record":{"id":"34f029d545eb11d6","repo":"multica-ai/multica","slug":"url-and-file-are-mutually-exclusive","errorCode":null,"errorMessage":"--url and --file are mutually exclusive","messagePattern":"--url and --file are mutually exclusive","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/cmd/multica/cmd_skill.go","lineNumber":462,"sourceCode":"\t}\n\n\tfmt.Printf(\"Skill updated from source: %s (%s)\\n\", strVal(result, \"name\"), strVal(result, \"id\"))\n\treturn nil\n}\n\nfunc runSkillImport(cmd *cobra.Command, _ []string) error {\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\timportURL, _ := cmd.Flags().GetString(\"url\")\n\timportFile, _ := cmd.Flags().GetString(\"file\")\n\tswitch {\n\tcase importURL == \"\" && importFile == \"\":\n\t\treturn fmt.Errorf(\"either --url or --file is required\")\n\tcase importURL != \"\" && importFile != \"\":\n\t\treturn fmt.Errorf(\"--url and --file are mutually exclusive\")\n\t}\n\tonConflict, _ := cmd.Flags().GetString(\"on-conflict\")\n\tif !validSkillImportConflictStrategy(onConflict) {\n\t\treturn fmt.Errorf(\"--on-conflict must be one of: fail, overwrite, rename, skip\")\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), cli.AtLeastAPITimeout(60*time.Second))\n\tdefer cancel()\n\n\tvar result map[string]any\n\tif importFile != \"\" {\n\t\tfileData, readErr := os.ReadFile(importFile)\n\t\tif readErr != nil {\n\t\t\treturn fmt.Errorf(\"read skill archive: %w\", readErr)\n\t\t}\n\t\tif err := client.ImportSkillFile(ctx, fileData, filepath.Base(importFile), onConflict, &result); err != nil {\n\t\t\tif handledErr := handleSkillImportError(cmd, err); handledErr != nil {\n\t\t\t\treturn handledErr","sourceCodeStart":444,"sourceCodeEnd":480,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_skill.go#L444-L480","documentation":"Client-side flag validation in `multica skill import`: both `--url` and `--file` were provided, but the command accepts exactly one bundle source. The mutual-exclusion switch runs before any network activity, so this is a usage error with zero side effects.","triggerScenarios":"Running `multica skill import --url https://… --file ./skill.zip`; a script unconditionally passes both flags with one left over from a previous edit; copy-pasting an example command that contained both.","commonSituations":"Wrapper scripts that always set --file as a default while an operator adds --url manually; iterating on a command in shell history and forgetting to delete the other flag.","solutions":["Remove one of the two flags — decide whether the bundle comes from the network or from disk.","In scripts, model the source as a single variable: pass `--url \"$SRC\"` when it starts with http, else `--file \"$SRC\"`.","If both a local and remote copy exist, prefer --file to avoid network flakiness."],"exampleFix":"# before\nmultica skill import --url https://example.com/skill.zip --file ./skill.zip\n\n# after\nmultica skill import --file ./skill.zip","handlingStrategy":"validation","validationCode":"# single-source-of-truth: never emit both flags\nif [ -n \"$IMPORT_URL\" ] && [ -n \"$IMPORT_FILE\" ]; then\n  echo \"pick one source: set IMPORT_URL or IMPORT_FILE, not both\"; exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Derive the flag from one variable instead of passing both conditionally.","Avoid copy-pasting example commands that include both flags.","Prefer --file when a local copy exists to keep imports deterministic."],"tags":["cli","validation","flags","mutually-exclusive"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}