{"record":{"id":"8c4c49ea846190b1","repo":"multica-ai/multica","slug":"create-workspace-w","errorCode":null,"errorMessage":"create workspace: %w","messagePattern":"create workspace: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_workspace.go","lineNumber":347,"sourceCode":"\nfunc runWorkspaceCreate(cmd *cobra.Command, _ []string) error {\n\tbody, err := buildWorkspaceCreateBody(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tclient.WorkspaceID = \"\"\n\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()\n\n\tvar ws map[string]any\n\tif err := client.PostJSON(ctx, \"/api/workspaces\", body, &ws); err != nil {\n\t\treturn fmt.Errorf(\"create workspace: %w\", err)\n\t}\n\treturn printWorkspace(cmd, ws)\n}\n\n// resolveWorkspaceByIDOrSlug looks up a workspace in the caller's accessible\n// list by full UUID, slug (case-insensitive), or short UUID prefix (≥4 hex\n// chars). The matching order is exact UUID → exact slug → prefix, so a slug\n// that happens to be a hex string can never be shadowed by a colliding UUID\n// prefix. Returns an error if no workspace matches, which doubles as the\n// \"access denied / does not exist\" check — the server only returns workspaces\n// the user is a member of, so a match implies access.\nfunc resolveWorkspaceByIDOrSlug(workspaces []workspaceSummary, target string) (workspaceSummary, error) {\n\ttarget = strings.TrimSpace(target)\n\tif target == \"\" {\n\t\treturn workspaceSummary{}, fmt.Errorf(\"workspace id, slug, or id prefix is required\")\n\t}\n\t// Slug comparison is case-insensitive (slugs are stored lowercase on the\n\t// server, but tolerate user-typed uppercase). UUIDs are also case-","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_workspace.go#L329-L365","documentation":"The POST /api/workspaces issued by `multica workspace create` failed. Flag-level validation already passed, so the wrapped error is server- or transport-side: duplicate slug (400/409), auth failure (401), permission limits, or an unreachable server.","triggerScenarios":"Creating a workspace whose slug already exists on the account, running with an expired token, or the server being down at request time. Note client.WorkspaceID is cleared first so the request goes to the global endpoint.","commonSituations":"Re-running a create script after a partial failure (slug already taken), team plan workspace-count limits, token expired between commands.","solutions":["Read the wrapped error: duplicate slug → pick a different --slug or use the existing workspace (`multica workspace list`).","401 → `multica login` and retry.","Connection error → verify the server URL / daemon status, then retry.","Plan/limit errors → remove unused workspaces or raise the limit."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"multica workspace list --output json 2>/dev/null | grep -q \"\\\"$SLUG\\\"\" && echo 'slug already in use: create will fail'","typeGuard":null,"tryCatchPattern":"out=$(multica workspace create --name \"$NAME\" --slug \"$SLUG\" 2>&1) || { case \"$out\" in *slug*|*exist*|*409*|*400*) echo 'slug taken: choose another'; exit 1 ;; *401*|*unauthorized*) multica login ;; *) echo \"$out\"; exit 1 ;; esac; }","preventionTips":["Check `workspace list` for slug collisions before creating.","Make create scripts idempotent: on duplicate-slug errors, adopt the existing workspace.","Re-login before bulk create operations to avoid mid-run 401s."],"tags":["cli","api","auth","workspace","validation"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}