{"record":{"id":"84c50d30e72ef9a6","repo":"windmill-labs/windmill","slug":"fork-workspace-name-is-too-long-effectivename-l","errorCode":null,"errorMessage":"Fork workspace name is too long (${effectiveName.length} chars; max 50). Choose a shorter name.","messagePattern":"Fork workspace name is too long \\((.+?) chars; max 50\\)\\. Choose a shorter name\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/workspace/fork.ts","lineNumber":215,"sourceCode":"    } else {\n      workspaceId = idDefault;\n    }\n  }\n\n  log.info(colors.blue(`Creating forked workspace: ${workspaceName}...`));\n\n  const trueWorkspaceId = `${WM_FORK_PREFIX}-${workspaceId}`;\n  // Fail fast on an invalid id (e.g. an explicit positional id, or a long\n  // branch name under --yes) before existsWorkspace, datatable cloning, and\n  // branch creation — a late backend rejection would leave cloned databases\n  // behind.\n  validateForkWorkspaceId(trueWorkspaceId);\n  // The workspace.name column is character varying(50); reject an over-long name\n  // up front (matching the name actually sent to the backend below) instead of\n  // failing late after databases are cloned and the git branch is created.\n  const effectiveName = opts.createWorkspaceName ?? workspaceName ?? trueWorkspaceId;\n  if (effectiveName.length > 50) {\n    throw new Error(\n      `Fork workspace name is too long (${effectiveName.length} chars; max 50). Choose a shorter name.`\n    );\n  }\n  let alreadyExists = false;\n  try {\n    alreadyExists = await wmill.existsWorkspace({\n      requestBody: { id: trueWorkspaceId },\n    });\n  } catch (e) {\n    log.info(\n      colors.red.bold(\"! Credentials or instance is invalid. Aborting.\")\n    );\n    throw e;\n  }\n\n  if (alreadyExists) {\n    throw new Error(\n      `This forked workspace '${workspaceId}' (${workspaceName}) already exists, possibly archived (archiving keeps the id reserved). ` +","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/workspace/fork.ts#L197-L233","documentation":"The backend's workspace.name column is varchar(50). The CLI validates the effective display name (`--create-workspace-name`, else the positional name, else the derived id) before creating anything, so you fail fast instead of after databases are cloned and the git branch created. Names over 50 characters are rejected.","triggerScenarios":"Passing a workspace_name positional or --create-workspace-name longer than 50 characters to `wmill workspace fork`; an explicit workspace id so long that the prefixed id is used as the name.","commonSituations":"Long descriptive branch names converted into fork ids under --yes (branch-derived ids can be long); pasting a long sentence as the friendly name; scripted forks embedding branch slugs from ticket systems.","solutions":["Pass a shorter workspace_name (<= 50 chars)","Shorten --create-workspace-name accordingly","If the id is derived from a long branch name, use a shorter explicit workspaceId positional so the fallback name fits"],"exampleFix":"// before\nwmill workspace fork \"my very long descriptive fork name that exceeds fifty characters in total\"\n// after\nwmill workspace fork \"my-short-fork\"","handlingStrategy":"validation","validationCode":"const effectiveName = opts.createWorkspaceName ?? workspaceName ?? workspaceId;\nif (effectiveName && effectiveName.length > 50) {\n  throw new Error(`Fork name ${effectiveName.length} chars; max is 50.`);\n}\nawait createWorkspaceFork(opts, workspaceName, workspaceId);","typeGuard":"function isValidForkName(name: string | undefined): name is string {\n  return typeof name === 'string' && name.length > 0 && name.length <= 50;\n}","tryCatchPattern":"try {\n  await createWorkspaceFork(opts, name, id);\n} catch (e) {\n  if ((e as Error).message.includes('name is too long')) {\n    console.error('Pass a workspace_name of 50 characters or fewer.');\n  } else throw e;\n}","preventionTips":["Keep fork display names under 50 characters","Shorten branch naming conventions if branch-derived ids become names under --yes","Truncate/slugify scripted names before passing them to the CLI"],"tags":["validation","naming","cli"],"backgroundTag":"name-too-long","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}