{"record":{"id":"8325e70c23682bd2","repo":"multica-ai/multica","slug":"query-is-required","errorCode":null,"errorMessage":"query is required","messagePattern":"query is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/cmd/multica/cmd_skill.go","lineNumber":603,"sourceCode":"}\n\nfunc nestedMap(m map[string]any, key string) map[string]any {\n\tnested, _ := m[key].(map[string]any)\n\tif nested == nil {\n\t\treturn map[string]any{}\n\t}\n\treturn nested\n}\n\nfunc runSkillSearch(cmd *cobra.Command, args []string) error {\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tquery := strings.TrimSpace(args[0])\n\tif query == \"\" {\n\t\treturn fmt.Errorf(\"query is required\")\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), cli.AtLeastAPITimeout(60*time.Second))\n\tdefer cancel()\n\n\tvar results []map[string]any\n\tpath := \"/api/skills/search?q=\" + url.QueryEscape(query)\n\tif err := client.GetJSON(ctx, path, &results); err != nil {\n\t\treturn fmt.Errorf(\"search skills: %w\", err)\n\t}\n\n\toutput, _ := cmd.Flags().GetString(\"output\")\n\tif output == \"json\" {\n\t\treturn cli.PrintJSON(os.Stdout, results)\n\t}\n\n\theaders := []string{\"NAME\", \"URL\", \"SOURCE\", \"INSTALLS\", \"DESCRIPTION\"}\n\trows := make([][]string, 0, len(results))","sourceCodeStart":585,"sourceCodeEnd":621,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_skill.go#L585-L621","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Provide a non-empty search term: `multica skill search \"web scraping\"`.","In scripts, guard the variable first: `[ -n \"$Q\" ] || { echo 'query required'; exit 1; }`.","Quote the argument so whitespace-only input is at least visible in the error."],"exampleFix":"# before\nmultica skill search \"\"\n\n# after\nmultica skill search \"table formatting\"","handlingStrategy":"validation","validationCode":"Q=\"$(echo \"$1\" | tr -d '[:space:]')\"\n[ -n \"$Q\" ] || { echo 'query required'; exit 1; }\nmultica skill search \"$Q\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Trim and test the search variable before invoking the CLI.","Quote the positional argument so shell word-splitting cannot silently drop it.","Remember the query is positional, not a flag: `skill search \"term\"`."],"tags":["cli","validation","search","skill"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}