{"record":{"id":"d76daa07e94c2223","repo":"multica-ai/multica","slug":"clear-cannot-be-combined-with-description","errorCode":null,"errorMessage":"--clear cannot be combined with --description / --description-stdin / --description-file","messagePattern":"--clear cannot be combined with --description / --description-stdin / --description-file","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_user.go","lineNumber":102,"sourceCode":"\t}\n\n\tprintUserProfileTable(os.Stdout, me)\n\treturn nil\n}\n\nfunc runUserProfileUpdate(cmd *cobra.Command, _ []string) error {\n\t// `--clear` is its own flag (not \"pass an empty string\") because cobra's\n\t// default value for a Changed(\"\") flag would otherwise be ambiguous with\n\t// \"user typed `--description \"\"`\". Keep both forms supported — the inline\n\t// empty string is what someone scripting bash would reach for.\n\tclearFlag, _ := cmd.Flags().GetBool(\"clear\")\n\tdesc, hasDesc, err := resolveTextFlag(cmd, \"description\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif clearFlag && hasDesc {\n\t\treturn fmt.Errorf(\"--clear cannot be combined with --description / --description-stdin / --description-file\")\n\t}\n\tif !clearFlag && !hasDesc && !cmd.Flags().Changed(\"description\") {\n\t\treturn fmt.Errorf(\"nothing to update; pass --description, --description-stdin, --description-file, or --clear\")\n\t}\n\n\tif clearFlag {\n\t\tdesc = \"\"\n\t}\n\n\tbody := map[string]any{\"profile_description\": desc}\n\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_user.go#L84-L120","documentation":"`multica user profile update` rejects the combination of the --clear flag with any of --description, --description-stdin, or --description-file. Clearing and setting a value in one invocation is ambiguous, so the command refuses rather than picking a winner.","triggerScenarios":"Running e.g. `multica user profile update --clear --description \"bio\"`, or --clear together with --description-stdin/-file. resolveTextFlag reports hasDesc=true whenever any of the three description flag variants was supplied.","commonSituations":"Shell scripts that append flags conditionally end up emitting both --clear and --description in the same invocation; copy-pasted command lines from runbooks.","solutions":["Split into two steps: run `--clear` alone, then a second command with the new --description.","If the intent is to replace the description, drop --clear and just pass --description.","Audit shell scripts for unconditional --clear alongside a description flag."],"exampleFix":"# before\nmultica user profile update --clear --description \"new bio\"\n\n# after\nmultica user profile update --description \"new bio\"","handlingStrategy":"validation","validationCode":"if [ -n \"$DESC\" ] && [ \"$CLEAR\" = \"true\" ]; then echo 'cannot combine --clear with a description'; exit 1; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Model --clear and --description as mutually exclusive in flag-parsing scripts.","Build CLI args arrays conditionally instead of concatenating flags unconditionally."],"tags":["cli","validation","flag","user-profile"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}