{"record":{"id":"f49e3a27083667b0","repo":"multica-ai/multica","slug":"name-is-required-f49e3a","errorCode":null,"errorMessage":"--name is required","messagePattern":"--name is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/cmd/multica/cmd_label.go","lineNumber":170,"sourceCode":"\t\t\tcreated = created[:10]\n\t\t}\n\t\trows := [][]string{{\n\t\t\tstrVal(label, \"id\"),\n\t\t\tstrVal(label, \"name\"),\n\t\t\tstrVal(label, \"color\"),\n\t\t\tcreated,\n\t\t}}\n\t\tcli.PrintTable(os.Stdout, headers, rows)\n\t\treturn nil\n\t}\n\treturn cli.PrintJSON(os.Stdout, label)\n}\n\nfunc runLabelCreate(cmd *cobra.Command, _ []string) error {\n\tname, _ := cmd.Flags().GetString(\"name\")\n\tcolor, _ := cmd.Flags().GetString(\"color\")\n\tif name == \"\" {\n\t\treturn fmt.Errorf(\"--name is required\")\n\t}\n\tif color == \"\" {\n\t\treturn fmt.Errorf(\"--color is required (e.g. #3b82f6)\")\n\t}\n\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()\n\n\tbody := map[string]any{\"name\": name, \"color\": color}\n\tvar result map[string]any\n\tif err := client.PostJSON(ctx, \"/api/labels\", body, &result); err != nil {\n\t\treturn fmt.Errorf(\"create label: %w\", err)\n\t}\n","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_label.go#L152-L188","documentation":"Thrown by `multica label create` when --name is omitted or empty. The CLI requires both a name and a color before it will POST /api/labels; this guard fires first and prevents an invalid request.","triggerScenarios":"Running `multica label create --color #3b82f6` without --name, or passing an empty `--name \"\"`.","commonSituations":"Users assume the name is positional (`label create \"bug\"`); scripts with unset name variables.","solutions":["Pass the name explicitly: `multica label create --name bug --color #3b82f6`","Guard scripts: fail early if the name variable is empty","Check flag spelling — a misspelled flag leaves name empty and triggers this error"],"exampleFix":"# before\nmultica label create \"bug\" --color #3b82f6\n# after\nmultica label create --name bug --color #3b82f6","handlingStrategy":"validation","validationCode":"# bash: require name and color for create\n[[ -n \"${NAME:-}\" && -n \"${COLOR:-}\" ]] || { echo \"--name and --color are required\" >&2; exit 2; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Name is a flag, not positional","set -u catches unset variables early","Template create commands with both flags"],"tags":["cli","flag-validation","labels"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}