windmill-labs/windmill · error · Error

Not logged in. Please run 'wmill workspace add' first.

Error message

Not logged in. Please run 'wmill workspace add' first.

What it means

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`.

Source

Thrown at cli/src/commands/workspace/merge.ts:259

    all?: boolean;
    skipConflicts?: boolean;
    include?: string;
    exclude?: string;
    preserveOnBehalfOf?: boolean;
    yes?: boolean;
  }
): Promise<void> {
  // 1. Resolve fork workspace
  const workspace = await tryResolveBranchWorkspace(opts);
  if (!workspace) {
    throw new Error(
      "Could not resolve workspace from branch name. Make sure you are in a git repo with 'workspaces' configured in wmill.yaml."
    );
  }

  const token = workspace.token;
  if (!token) {
    throw new Error("Not logged in. Please run 'wmill workspace add' first.");
  }

  const remote = workspace.remote;
  setClient(
    token,
    remote.endsWith("/") ? remote.substring(0, remote.length - 1) : remote
  );

  const forkWorkspaceId = workspace.workspaceId;

  // 2. Find parent workspace
  const userWorkspaces = await wmill.listUserWorkspaces();
  const forkEntry = userWorkspaces.workspaces?.find(
    (w) => w.id === forkWorkspaceId
  );

  if (!forkEntry?.parent_workspace_id) {
    throw new Error(

View on GitHub (pinned to e474e8803c)

Solutions

  1. Run `wmill workspace add` (or `wmill workspace login`) to store a token for the workspace
  2. Re-authenticate if the token was revoked
  3. Set up credentials in CI via the token option/env before merging

Example fix

// before
$ wmill workspace merge   # no token stored
// after
wmill workspace add my-fork --remote https://app.windmill.dev --token <TOKEN>
wmill workspace merge
Defensive patterns

Strategy: validation

Validate before calling

const ws = await tryResolveBranchWorkspace(opts);
if (!ws?.token) {
  throw new Error('No token for this workspace; run wmill workspace add first.');
}

Type guard

function hasToken(w: { token?: string | null }): w is { token: string } {
  return typeof w.token === 'string' && w.token.length > 0;
}

Try / catch

try {
  await mergeWorkspaces(opts);
} catch (e) {
  if (e.message.includes('Not logged in')) {
    log.error('Authenticate with `wmill workspace add` and retry.');
  } else throw e;
}

Prevention

When it happens

Trigger: `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.

Common situations: Fresh machine where wmill.yaml is committed but the local credential store is empty; token revoked/removed; CI environment missing the login step.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/f46210df965071cd. Report an issue: GitHub.