{"record":{"id":"391cfeb69f166efe","repo":"multica-ai/multica","slug":"slug-is-required","errorCode":null,"errorMessage":"--slug is required","messagePattern":"--slug is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_workspace.go","lineNumber":293,"sourceCode":"\t} else {\n\t\tfmt.Fprintln(os.Stderr, \"\\nNo default workspace set. Use 'multica workspace switch <id|slug|prefix>' to pick one.\")\n\t}\n\tfmt.Fprintln(os.Stderr, \"Tip: pass the ID column, SLUG, or full UUID (--full-id) to 'workspace get/update/switch'.\")\n\treturn nil\n}\n\nfunc buildWorkspaceCreateBody(cmd *cobra.Command) (map[string]any, error) {\n\tname, _ := cmd.Flags().GetString(\"name\")\n\tif strings.TrimSpace(name) == \"\" {\n\t\treturn nil, fmt.Errorf(\"--name is required\")\n\t}\n\n\t// The server requires both name and slug (POST /api/workspaces returns 400\n\t// without them) and the slug is immutable after creation, so it must be\n\t// chosen explicitly here rather than silently omitted.\n\tslug, _ := cmd.Flags().GetString(\"slug\")\n\tif strings.TrimSpace(slug) == \"\" {\n\t\treturn nil, fmt.Errorf(\"--slug is required\")\n\t}\n\n\t// A single stdin stream cannot feed two fields: whichever field reads first\n\t// drains it and the other gets EOF. Reject the ambiguous combination up\n\t// front instead of surfacing a misleading \"content is empty\" error.\n\tdescStdin, _ := cmd.Flags().GetBool(\"description-stdin\")\n\tctxStdin, _ := cmd.Flags().GetBool(\"context-stdin\")\n\tif descStdin && ctxStdin {\n\t\treturn nil, fmt.Errorf(\"--description-stdin and --context-stdin cannot be combined; a single stdin cannot feed both fields — pass one of them inline\")\n\t}\n\n\tbody := map[string]any{\"name\": name, \"slug\": slug}\n\tif cmd.Flags().Changed(\"description\") || cmd.Flags().Changed(\"description-stdin\") {\n\t\tdesc, _, err := resolveTextFlag(cmd, \"description\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbody[\"description\"] = desc","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_workspace.go#L275-L311","documentation":"`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.","triggerScenarios":"Running `multica workspace create --name \"My Team\"` with no --slug, or --slug \" \" — the check fires before the POST /api/workspaces call.","commonSituations":"Users assuming the CLI will slugify the name automatically; scripts passing an empty slug variable.","solutions":["Choose a permanent, URL-friendly slug: `multica workspace create --name \"My Team\" --slug my-team`.","Treat the slug as immutable: renaming later requires a new workspace, so pick it deliberately now.","Script guard: fail before invoking if the slug variable is empty."],"exampleFix":"# before\nmultica workspace create --name \"My Team\"\n\n# after\nmultica workspace create --name \"My Team\" --slug my-team","handlingStrategy":"validation","validationCode":": \"${SLUG:?--slug is required (immutable after creation)}\"\ncase \"$SLUG\" in *[!a-z0-9-]*) echo 'slug should be lowercase kebab-case'; exit 1 ;; esac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Derive the slug deliberately once — it is immutable after creation.","Standardize on lowercase kebab-case slugs to match server expectations."],"tags":["cli","validation","flag","workspace"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}