{"record":{"id":"f15d38f83c2a4694","repo":"multica-ai/multica","slug":"name-must-not-be-empty","errorCode":null,"errorMessage":"--name must not be empty","messagePattern":"--name must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_agent_copy.go","lineNumber":132,"sourceCode":"\ttargetRuntimeID := srcRuntimeID\n\tif cmd.Flags().Changed(\"runtime-id\") {\n\t\tv, _ := cmd.Flags().GetString(\"runtime-id\")\n\t\tif v == \"\" {\n\t\t\treturn fmt.Errorf(\"--runtime-id must not be empty\")\n\t\t}\n\t\ttargetRuntimeID = v\n\t}\n\tif targetRuntimeID == \"\" {\n\t\treturn fmt.Errorf(\"source agent has no runtime; pass --runtime-id to choose a target runtime\")\n\t}\n\tsameRuntime := targetRuntimeID == srcRuntimeID\n\n\t// Name: default \"<source name> (copy)\", override with --name.\n\tname := strVal(src, \"name\") + \" (copy)\"\n\tif cmd.Flags().Changed(\"name\") {\n\t\tv, _ := cmd.Flags().GetString(\"name\")\n\t\tif v == \"\" {\n\t\t\treturn fmt.Errorf(\"--name must not be empty\")\n\t\t}\n\t\tname = v\n\t}\n\n\tbody := map[string]any{\n\t\t\"name\":       name,\n\t\t\"runtime_id\": targetRuntimeID,\n\t}\n\n\t// Plain-text fields: copy from source, override with the matching flag.\n\tbody[\"description\"] = strVal(src, \"description\")\n\tif cmd.Flags().Changed(\"description\") {\n\t\tv, _ := cmd.Flags().GetString(\"description\")\n\t\tbody[\"description\"] = v\n\t}\n\tbody[\"instructions\"] = strVal(src, \"instructions\")\n\tif cmd.Flags().Changed(\"instructions\") {\n\t\tv, _ := cmd.Flags().GetString(\"instructions\")","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_agent_copy.go#L114-L150","documentation":"Thrown by `multica agent copy` when --name was explicitly changed on the command line but its value is the empty string. The default name is \"<source name> (copy)\"; the check only fires when the flag is actively set to empty. Client-side validation before the create request.","triggerScenarios":"`multica agent copy <id> --name \"\"` or `--name \"$NAME\"` with NAME unset/empty in the shell.","commonSituations":"Wrapper scripts with optional naming where the variable is missing; CI pipelines templating the name from an empty build parameter.","solutions":["Provide a non-empty name: multica agent copy <id> --name \"my-agent-prod\"","Or drop --name to accept the default \"<source> (copy)\"","In scripts, add the flag only when the variable is non-empty"],"exampleFix":"# before\nmultica agent copy <id> --name \"$NEW_NAME\"   # NEW_NAME=\"\"\n# after\nmultica agent copy <id> --name \"billing-agent-copy\"","handlingStrategy":"validation","validationCode":"[ -n \"${NEW_NAME:-}\" ] && multica agent copy \"$AGENT_ID\" --name \"$NEW_NAME\" || multica agent copy \"$AGENT_ID\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default to omitting --name to get the '(copy)' suffix","Guard optional name variables with non-empty checks before building the command","Use set -u in scripts to catch unset variables"],"tags":["cli","flags","validation","go"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}