multica-ai/multica · warning

either --url or --file is required

Error message

either --url or --file is required

What it means

Pure client-side flag validation in `multica skill import`: the command requires exactly one source for the skill bundle, and neither `--url` nor `--file` was provided. No network call has been made yet — cobra returns this before the API client is even used for the request.

Source

Thrown at server/cmd/multica/cmd_skill.go:460

	if output == "json" {
		return cli.PrintJSON(os.Stdout, result)
	}

	fmt.Printf("Skill updated from source: %s (%s)\n", strVal(result, "name"), strVal(result, "id"))
	return nil
}

func runSkillImport(cmd *cobra.Command, _ []string) error {
	client, err := newAPIClient(cmd)
	if err != nil {
		return err
	}

	importURL, _ := cmd.Flags().GetString("url")
	importFile, _ := cmd.Flags().GetString("file")
	switch {
	case importURL == "" && importFile == "":
		return fmt.Errorf("either --url or --file is required")
	case importURL != "" && importFile != "":
		return fmt.Errorf("--url and --file are mutually exclusive")
	}
	onConflict, _ := cmd.Flags().GetString("on-conflict")
	if !validSkillImportConflictStrategy(onConflict) {
		return fmt.Errorf("--on-conflict must be one of: fail, overwrite, rename, skip")
	}

	ctx, cancel := context.WithTimeout(context.Background(), cli.AtLeastAPITimeout(60*time.Second))
	defer cancel()

	var result map[string]any
	if importFile != "" {
		fileData, readErr := os.ReadFile(importFile)
		if readErr != nil {
			return fmt.Errorf("read skill archive: %w", readErr)
		}
		if err := client.ImportSkillFile(ctx, fileData, filepath.Base(importFile), onConflict, &result); err != nil {

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Add exactly one source flag: `multica skill import --url https://example.com/skill.zip` or `multica skill import --file ./skill.zip`.
  2. If driven by a script, default the variable or fail early: `: "${SKILL_URL:?SKILL_URL must be set}" before invoking the CLI.
  3. Run `multica skill import --help` to review accepted flags.

Example fix

# before
multica skill import

# after
multica skill import --url https://example.com/skills/my-skill.zip --on-conflict fail
Defensive patterns

Strategy: validation

Validate before calling

: "${SKILL_SRC:?set SKILL_SRC to a URL or local file path}"
case "$SKILL_SRC" in
  http://*|https://*) SRC_FLAG=(--url "$SKILL_SRC") ;;
  *) test -f "$SKILL_SRC" || { echo "not a file: $SKILL_SRC"; exit 1; }; SRC_FLAG=(--file "$SKILL_SRC") ;;
esac
multica skill import "${SRC_FLAG[@]}"

Prevention

When it happens

Trigger: Running `multica skill import` with no flags; providing only auxiliary flags like `--on-conflict skip` while forgetting the source; a wrapper script that builds the command from variables where both the URL and file variables are empty strings.

Common situations: Shell script passes "$SKILL_URL" but the env var is unset, expanding to nothing; user assumes the command is interactive and prompts for a source; CI job parameter misconfiguration.

Related errors


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