multica-ai/multica · error
server name must not be empty
Error message
server name must not be empty
What it means
Local validation in `multica workspace mcp add`: the first positional argument (the MCP server name) is empty after trimming whitespace. Cobra guarantees an argument is present (Args constraint), but it can be an empty or whitespace-only string, which is not a usable server name.
Source
Thrown at server/cmd/multica/cmd_workspace.go:633
if err != nil {
return err
}
ctx, cancel := cli.APIContext(context.Background())
defer cancel()
var servers []workspaceMcpServer
if err := client.GetJSON(ctx, "/api/workspaces/"+wsID+"/mcp-servers", &servers); err != nil {
return fmt.Errorf("list workspace mcp servers: %w", err)
}
return printWorkspaceMcpServers(cmd, servers)
}
func runWorkspaceMcpAdd(cmd *cobra.Command, args []string) error {
serverName := strings.TrimSpace(args[0])
if serverName == "" {
return fmt.Errorf("server name must not be empty")
}
wsID, err := resolveWorkspaceArg(cmd, args[1:])
if err != nil {
return err
}
if wsID == "" {
return fmt.Errorf("workspace ID is required: pass an id/slug/prefix as argument or set MULTICA_WORKSPACE_ID")
}
entry, ok, err := resolveMcpJSONObject(cmd, "server-config", false)
if err != nil {
return err
}
if !ok {
return fmt.Errorf("one of --server-config, --server-config-stdin, or --server-config-file is required")
}
client, err := newAPIClient(cmd)View on GitHub (pinned to 2c0912b6ec)
Solutions
- Provide a real server name: `multica workspace mcp add github acme --server-config '{...}'`
- Check argument order: name first, then optional workspace identifier
- In scripts, guard: `[ -n "$NAME" ] || exit 1` before invoking
Example fix
# before
multica workspace mcp add "$SERVER_NAME" acme --server-config "$CFG"
# after
: "${SERVER_NAME:?server name required}"
multica workspace mcp add "$SERVER_NAME" acme --server-config "$CFG" Defensive patterns
Strategy: validation
Validate before calling
serverName := strings.TrimSpace(args[0])
if serverName == "" {
return errors.New("server name must not be empty")
} Prevention
- Use shell parameter defaults that fail fast: `: "${SERVER_NAME:?}"
- Trim and check user-supplied names before invoking the CLI
- Remember argument order: name first, workspace second
When it happens
Trigger: Running `multica workspace mcp add "" <ws>` or `multica workspace mcp add " " <ws>` — an explicitly empty server-name argument.
Common situations: Shell scripts passing an unset variable (`multica workspace mcp add "$NAME" ...` with NAME empty); copy-paste commands with a missing name placeholder; argument order confusion where flags land in the first position.
Related errors
- server ID must not be empty
- %s must be a JSON object, or 'null' to clear
- one of --server-config, --server-config-stdin, or --server-c
- nothing to update; pass --name and/or one of --server-config
- config must be a JSON object
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/86628916932dfef6.
Report an issue: GitHub.