windmill-labs/windmill · error · Error

Could not resolve parent workspace. Make sure you are in a g

Error message

Could not resolve parent workspace. Make sure you are in a git repo with 'workspaces' configured in wmill.yaml, or create a local workspace profile for the fork.

What it means

When deleting a fork that has no local workspace profile, `deleteWorkspaceFork` falls back to resolving the parent workspace from the branch config via `tryResolveBranchWorkspace`. If that fails (no git repo or no `workspaces` mapping in wmill.yaml), it cannot construct the fork's credentials/id and throws.

Source

Thrown at cli/src/commands/workspace/fork.ts:569

  const orgWorkspaces = await allWorkspaces(opts.configDir);
  const idxOf = orgWorkspaces.findIndex((x) => x.name === name);

  if (idxOf !== -1) {
    const workspace = orgWorkspaces[idxOf];
    if (!workspace.workspaceId.startsWith(WM_FORK_PREFIX)) {
      throw new Error(
        `You can only delete forked workspaces where the workspace id starts with \`${WM_FORK_PREFIX}.\` Failed while attempting to delete \`${workspace.workspaceId}\``,
      );
    }
    forkWorkspaceId = workspace.workspaceId;
    token = workspace.token;
    remote = workspace.remote;
    hasLocalProfile = true;
  } else {
    // Fallback: resolve parent workspace from branch config and construct fork ID
    const parentWorkspace = await tryResolveBranchWorkspace(opts);
    if (!parentWorkspace) {
      throw new Error(
        "Could not resolve parent workspace. Make sure you are in a git repo with 'workspaces' configured in wmill.yaml, or create a local workspace profile for the fork.",
      );
    }
    forkWorkspaceId = name.startsWith(`${WM_FORK_PREFIX}-`) ? name : `${WM_FORK_PREFIX}-${name}`;
    token = parentWorkspace.token;
    remote = parentWorkspace.remote;
  }

  if (!opts.yes) {
    const { Select } = await import("@cliffy/prompt/select");
    const choice = await Select.prompt({
      message: `Are you sure you want to delete the forked workspace \`${forkWorkspaceId}\`?`,
      options: [
        { name: "Yes", value: "confirm" },
        { name: "No", value: "cancel" },
      ],
    });

View on GitHub (pinned to e474e8803c)

Solutions

  1. Create a local workspace profile for the fork (`wmill workspace add`)
  2. Run from the git repo root with `workspaces` configured in wmill.yaml
  3. Pass the fork by its local profile name so the fallback is not needed

Example fix

# before
$ wmill workspace fork delete my-fork  # no profile, no git config
// after
wmill workspace add my-fork --remote https://... --token ... && wmill workspace fork delete my-fork
Defensive patterns

Strategy: fallback

Validate before calling

const parent = await tryResolveBranchWorkspace(opts);
if (!parent && !hasLocalProfile(name)) {
  console.error('Create a local profile (wmill workspace add) or configure workspaces in wmill.yaml');
  process.exit(1);
}

Type guard

function canResolveParent(opts: Opts): Promise<boolean> {
  return tryResolveBranchWorkspace(opts).then(p => p !== null);
}

Try / catch

try {
  await deleteWorkspaceFork(name, opts);
} catch (e) {
  if (e.message.includes('Could not resolve parent workspace')) {
    log.error('Run from the git repo root or add a local workspace profile.');
  } else throw e;
}

Prevention

When it happens

Trigger: `wmill workspace fork delete` on a workspace without a local profile while `tryResolveBranchWorkspace` returns null — outside a git repo, or wmill.yaml lacks the `workspaces` section.

Common situations: Deleting a fork after the wmill.yaml workspaces block was removed; running the CLI in a subdirectory/copy that is not a git repo; collaborator who never added the local workspace profile.

Related errors


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