windmill-labs/windmill · error · Error

No base branches are configured in wmill.yaml's workspaces s

Error message

No base branches are configured in wmill.yaml's workspaces section, so the fork can't be linked to a parent. Add the parent workspace to wmill.yaml, or pass --from-branch <base>.

What it means

After the user agrees to fork, the branch must be linked to a parent workspace listed under `workspaces` in wmill.yaml. When `listConfiguredBaseBranches` finds no base branches configured, the fork cannot be linked to a parent, so the command throws.

Source

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

      `or check out a base branch and run \`wmill workspace fork\` to create a fresh fork branch.`,
    );
  }

  const { Select } = await import("@cliffy/prompt/select");
  const proceed = await Select.prompt({
    message: `You're on working branch \`${currentBranch}\`, not a base branch. Base a fork on it and rename it onto the fork branch?`,
    options: [
      { name: "Yes, base the fork on this branch and rename it", value: "yes" },
      { name: "No, cancel", value: "no" },
    ],
  });
  if (proceed !== "yes") {
    throw new Error("Fork cancelled. Check out a base branch to create a fresh fork branch instead.");
  }

  const baseBranches = listConfiguredBaseBranches(config);
  if (baseBranches.length === 0) {
    throw new Error(
      `No base branches are configured in wmill.yaml's workspaces section, so the fork can't be linked to a parent. ` +
      `Add the parent workspace to wmill.yaml, or pass --from-branch <base>.`,
    );
  }
  if (baseBranches.length === 1) {
    log.info(`Basing the fork on \`${baseBranches[0]}\`.`);
    return baseBranches[0];
  }
  return await Select.prompt({
    message: "Which base branch is this fork based on (the parent)?",
    options: baseBranches.map((b) => ({ name: b, value: b })),
  });
}

// The backend caps a fork workspace id (`wm-fork-<slug>`) at 50 chars total
// (validate_fork_workspace_id in windmill-common), so the slug is at most
// 50 - "wm-fork-".length (8) = 42.
const MAX_FORK_ID_SLUG = 42;

View on GitHub (pinned to e474e8803c)

Solutions

  1. Add the parent workspace and its base branches to the `workspaces` section of wmill.yaml
  2. Pass `--from-branch <base>` to base the fork explicitly
  3. Verify you are in the repo root where wmill.yaml lives

Example fix

# before (wmill.yaml)
workspaces: {}
# after
workspaces:
  main:
    path: ["main"]
    workspace: my-ws
    default: true
Defensive patterns

Strategy: validation

Validate before calling

const cfg = await readConfigFile(configDir);
if (listConfiguredBaseBranches(cfg).length === 0) {
  throw new Error('Add workspaces/base branches to wmill.yaml first');
}

Type guard

function hasBaseBranches(cfg: unknown): cfg is Config & { workspaces: Record<string, unknown> } {
  return !!cfg && typeof cfg === 'object' && 'workspaces' in cfg && Object.keys((cfg as any).workspaces ?? {}).length > 0;
}

Try / catch

try {
  await createWorkspaceFork(opts, cfg, branch);
} catch (e) {
  if (e.message.includes('No base branches are configured')) {
    log.error('Add the parent workspace to wmill.yaml workspaces section.');
  } else throw e;
}

Prevention

When it happens

Trigger: Interactive `wmill workspace fork` accepted the prompt, but wmill.yaml has no `workspaces` section entries defining base branches, and no `--from-branch` was given.

Common situations: Fresh clone where wmill.yaml only has the default workspace profile; team repo where the workspaces mapping was never added; yaml edited and the workspaces block removed.

Related errors


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