{"record":{"id":"f46210df965071cd","repo":"windmill-labs/windmill","slug":"not-logged-in-please-run-wmill-workspace-add-fi-f46210","errorCode":null,"errorMessage":"Not logged in. Please run 'wmill workspace add' first.","messagePattern":"Not logged in\\. Please run 'wmill workspace add' first\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/workspace/merge.ts","lineNumber":259,"sourceCode":"    all?: boolean;\n    skipConflicts?: boolean;\n    include?: string;\n    exclude?: string;\n    preserveOnBehalfOf?: boolean;\n    yes?: boolean;\n  }\n): Promise<void> {\n  // 1. Resolve fork workspace\n  const workspace = await tryResolveBranchWorkspace(opts);\n  if (!workspace) {\n    throw new Error(\n      \"Could not resolve workspace from branch name. Make sure you are in a git repo with 'workspaces' configured in wmill.yaml.\"\n    );\n  }\n\n  const token = workspace.token;\n  if (!token) {\n    throw new Error(\"Not logged in. Please run 'wmill workspace add' first.\");\n  }\n\n  const remote = workspace.remote;\n  setClient(\n    token,\n    remote.endsWith(\"/\") ? remote.substring(0, remote.length - 1) : remote\n  );\n\n  const forkWorkspaceId = workspace.workspaceId;\n\n  // 2. Find parent workspace\n  const userWorkspaces = await wmill.listUserWorkspaces();\n  const forkEntry = userWorkspaces.workspaces?.find(\n    (w) => w.id === forkWorkspaceId\n  );\n\n  if (!forkEntry?.parent_workspace_id) {\n    throw new Error(","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/workspace/merge.ts#L241-L277","documentation":"After resolving the fork workspace from the branch, `mergeWorkspaces` requires a stored auth token. A resolved workspace with no token means the user is not logged in to that workspace, so the merge aborts with a directive to run `wmill workspace add`.","triggerScenarios":"`wmill workspace merge` when the workspace profile resolved from the branch has `token` undefined/null — the workspace was configured but credentials were never added or were cleared.","commonSituations":"Fresh machine where wmill.yaml is committed but the local credential store is empty; token revoked/removed; CI environment missing the login step.","solutions":["Run `wmill workspace add` (or `wmill workspace login`) to store a token for the workspace","Re-authenticate if the token was revoked","Set up credentials in CI via the token option/env before merging"],"exampleFix":"// before\n$ wmill workspace merge   # no token stored\n// after\nwmill workspace add my-fork --remote https://app.windmill.dev --token <TOKEN>\nwmill workspace merge","handlingStrategy":"validation","validationCode":"const ws = await tryResolveBranchWorkspace(opts);\nif (!ws?.token) {\n  throw new Error('No token for this workspace; run wmill workspace add first.');\n}","typeGuard":"function hasToken(w: { token?: string | null }): w is { token: string } {\n  return typeof w.token === 'string' && w.token.length > 0;\n}","tryCatchPattern":"try {\n  await mergeWorkspaces(opts);\n} catch (e) {\n  if (e.message.includes('Not logged in')) {\n    log.error('Authenticate with `wmill workspace add` and retry.');\n  } else throw e;\n}","preventionTips":["Run wmill workspace add on new machines before merge operations","Inject tokens in CI environments","Re-check credentials after token rotation/revocation"],"tags":["cli","auth","token","not-logged-in"],"backgroundTag":"not-logged-in","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"}