multica-ai/multica · error
--name is required
Error message
--name is required
What it means
runAgentCreate validates the required --name flag before building the POST /api/agents body and fails fast when it is empty. The check is a plain presence test — any non-empty string passes, the server does semantic validation later.
Source
Thrown at server/cmd/multica/cmd_agent.go:639
targets = append(targets, map[string]any{"target_type": "workspace"})
}
if members, _ := cmd.Flags().GetStringSlice("public-to-member"); len(members) > 0 {
for _, m := range members {
targets = append(targets, map[string]any{"target_type": "member", "target_id": m})
}
}
body["invocation_targets"] = targets
}
func runAgentCreate(cmd *cobra.Command, _ []string) error {
client, err := newAPIClient(cmd)
if err != nil {
return err
}
name, _ := cmd.Flags().GetString("name")
if name == "" {
return fmt.Errorf("--name is required")
}
runtimeID, _ := cmd.Flags().GetString("runtime-id")
if runtimeID == "" {
return fmt.Errorf("--runtime-id is required")
}
body := map[string]any{
"name": name,
"runtime_id": runtimeID,
}
if v, _ := cmd.Flags().GetString("description"); v != "" {
body["description"] = v
}
if v, _ := cmd.Flags().GetString("instructions"); v != "" {
body["instructions"] = v
}
if cmd.Flags().Changed("runtime-config") {
v, _ := cmd.Flags().GetString("runtime-config")View on GitHub (pinned to 2c0912b6ec)
Solutions
- Pass a non-empty --name on the command line.
- In scripts, guard the variable first and skip/error before invoking the CLI.
- Check for shell quoting issues like --name $NAME with NAME unset (use "$NAME").
Example fix
# before multica agent create --runtime-id rt_cli # after multica agent create --name "code-reviewer" --runtime-id rt_cli
Defensive patterns
Strategy: validation
Validate before calling
name := strings.TrimSpace(nameFlag)
if name == "" {
return fmt.Errorf("--name is required")
} Prevention
- In scripts, guard required variables before invoking the CLI and fail with context.
- Quote flag values ("$NAME") so empty variables are visible instead of silently dropped.
- Consider marking flags required in cobra (MarkFlagRequired) so usage help fires first.
When it happens
Trigger: Running `multica agent create` without --name, or with --name "" / only-whitespace that cobra still delivers as empty.
Common situations: Scripted creation loops where the name variable is conditionally empty; shell quoting mistakes that swallow the value; interactive use forgetting the flag.
Related errors
- --runtime-id is required
- --runtime-config must be valid JSON: %w
- invalid direction %q (want \"up\" or \"down\")
- list agents: %w
- get agent: %w
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/5a61f3e2a3bdb19a.
Report an issue: GitHub.