multica-ai/multica · warning

query is required

Error message

query is required

What it means

Client-side validation in `multica skill search`: the positional query argument, after strings.TrimSpace, is empty. The command takes the query as args[0], so this fires when the first positional argument is missing, blank, or only whitespace. No network call is made.

Source

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

}

func nestedMap(m map[string]any, key string) map[string]any {
	nested, _ := m[key].(map[string]any)
	if nested == nil {
		return map[string]any{}
	}
	return nested
}

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

	query := strings.TrimSpace(args[0])
	if query == "" {
		return fmt.Errorf("query is required")
	}

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

	var results []map[string]any
	path := "/api/skills/search?q=" + url.QueryEscape(query)
	if err := client.GetJSON(ctx, path, &results); err != nil {
		return fmt.Errorf("search skills: %w", err)
	}

	output, _ := cmd.Flags().GetString("output")
	if output == "json" {
		return cli.PrintJSON(os.Stdout, results)
	}

	headers := []string{"NAME", "URL", "SOURCE", "INSTALLS", "DESCRIPTION"}
	rows := make([][]string, 0, len(results))

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Provide a non-empty search term: `multica skill search "web scraping"`.
  2. In scripts, guard the variable first: `[ -n "$Q" ] || { echo 'query required'; exit 1; }`.
  3. Quote the argument so whitespace-only input is at least visible in the error.

Example fix

# before
multica skill search ""

# after
multica skill search "table formatting"
Defensive patterns

Strategy: validation

Validate before calling

Q="$(echo "$1" | tr -d '[:space:]')"
[ -n "$Q" ] || { echo 'query required'; exit 1; }
multica skill search "$Q"

Prevention

When it happens

Trigger: Running `multica skill search` with no argument; passing `" "` or `""` (quoted empty string) as the argument; a script passing an unset variable `multica skill search "$Q"` where Q is empty. Note: cobra's default Args handling lets the command run with zero args, which then panics or errors here depending on arity — always pass a query.

Common situations: Unset search variable in a wrapper script; user expects an interactive search prompt; trailing-pipe mistakes like `multica skill search $(grep foo bar.txt)` where grep printed nothing.

Related errors


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