windmill-labs/windmill · error · Error
Could not resolve workspace from branch name. Make sure you
Error message
Could not resolve workspace from branch name. Make sure you are in a git repo with 'workspaces' configured in wmill.yaml.
What it means
`wmill workspace merge` resolves the fork workspace purely from the current git branch name via `tryResolveBranchWorkspace`. If the branch does not map to a workspace (not a git repo, or no `workspaces` section in wmill.yaml), the merge cannot proceed and this error is thrown at the very first step.
Source
Thrown at cli/src/commands/workspace/merge.ts:252
// ---------------------------------------------------------------------------
// Main merge command
// ---------------------------------------------------------------------------
async function mergeWorkspaces(
opts: GlobalOptions & {
direction?: string;
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 workspaceView on GitHub (pinned to e474e8803c)
Solutions
- Run from the repo root on a branch that is mapped in wmill.yaml's `workspaces` section
- Add the branch → workspace mapping to wmill.yaml
- Check out the fork branch before merging
Example fix
# before
$ wmill workspace merge # on unmapped branch
# after (wmill.yaml)
workspaces:
my-feature:
path: ["my-feature"]
workspace: wm-fork-my-feature Defensive patterns
Strategy: validation
Validate before calling
const ws = await tryResolveBranchWorkspace(opts);
if (!ws) {
throw new Error('Current branch does not map to a workspace; check wmill.yaml workspaces.');
} Type guard
function resolvesToWorkspace(w: Awaited<ReturnType<typeof tryResolveBranchWorkspace>>): w is NonNullable<typeof w> {
return w !== null;
} Try / catch
try {
await mergeWorkspaces(opts);
} catch (e) {
if (e.message.includes('Could not resolve workspace from branch name')) {
log.error('Add a branch→workspace mapping in wmill.yaml.');
} else throw e;
} Prevention
- Map every fork branch in wmill.yaml's workspaces section
- Run merge only from the repo root
- Avoid detached HEAD states when merging
When it happens
Trigger: Running `wmill workspace merge` from a directory that is not a git repo, on a branch with no matching entry in wmill.yaml's `workspaces` mapping, or when wmill.yaml has no workspaces config.
Common situations: Detached HEAD or freshly created branch not added to wmill.yaml; running the CLI outside the repo; teammates cloning without the shared wmill.yaml workspaces block.
Related errors
- No instance found, please add one first
- No local instance profile named ${instanceName}
- No active instance. Run 'wmill instance add' or pass --insta
- Active instance ${activeName} not found in config
- You are on working branch \`${currentBranch}\`, which is not
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/40bf497cf4273a39.
Report an issue: GitHub.