multica-ai/multica · error

--slug is required

Error message

--slug is required

What it means

`multica workspace create` requires an explicit --slug because the slug is immutable after creation and the server rejects the POST without it; silently generating one would lock the user into an unchosen identifier. Whitespace-only slugs are trimmed and rejected the same as missing ones.

Source

Thrown at server/cmd/multica/cmd_workspace.go:293

	} else {
		fmt.Fprintln(os.Stderr, "\nNo default workspace set. Use 'multica workspace switch <id|slug|prefix>' to pick one.")
	}
	fmt.Fprintln(os.Stderr, "Tip: pass the ID column, SLUG, or full UUID (--full-id) to 'workspace get/update/switch'.")
	return nil
}

func buildWorkspaceCreateBody(cmd *cobra.Command) (map[string]any, error) {
	name, _ := cmd.Flags().GetString("name")
	if strings.TrimSpace(name) == "" {
		return nil, fmt.Errorf("--name is required")
	}

	// The server requires both name and slug (POST /api/workspaces returns 400
	// without them) and the slug is immutable after creation, so it must be
	// chosen explicitly here rather than silently omitted.
	slug, _ := cmd.Flags().GetString("slug")
	if strings.TrimSpace(slug) == "" {
		return nil, fmt.Errorf("--slug is required")
	}

	// A single stdin stream cannot feed two fields: whichever field reads first
	// drains it and the other gets EOF. Reject the ambiguous combination up
	// front instead of surfacing a misleading "content is empty" error.
	descStdin, _ := cmd.Flags().GetBool("description-stdin")
	ctxStdin, _ := cmd.Flags().GetBool("context-stdin")
	if descStdin && ctxStdin {
		return nil, fmt.Errorf("--description-stdin and --context-stdin cannot be combined; a single stdin cannot feed both fields — pass one of them inline")
	}

	body := map[string]any{"name": name, "slug": slug}
	if cmd.Flags().Changed("description") || cmd.Flags().Changed("description-stdin") {
		desc, _, err := resolveTextFlag(cmd, "description")
		if err != nil {
			return nil, err
		}
		body["description"] = desc

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Choose a permanent, URL-friendly slug: `multica workspace create --name "My Team" --slug my-team`.
  2. Treat the slug as immutable: renaming later requires a new workspace, so pick it deliberately now.
  3. Script guard: fail before invoking if the slug variable is empty.

Example fix

# before
multica workspace create --name "My Team"

# after
multica workspace create --name "My Team" --slug my-team
Defensive patterns

Strategy: validation

Validate before calling

: "${SLUG:?--slug is required (immutable after creation)}"
case "$SLUG" in *[!a-z0-9-]*) echo 'slug should be lowercase kebab-case'; exit 1 ;; esac

Prevention

When it happens

Trigger: Running `multica workspace create --name "My Team"` with no --slug, or --slug " " — the check fires before the POST /api/workspaces call.

Common situations: Users assuming the CLI will slugify the name automatically; scripts passing an empty slug variable.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/391cfeb69f166efe. Report an issue: GitHub.