windmill-labs/windmill · error · Error
Invalid direction '${opts.direction}'. Use 'to-parent' or 't
Error message
Invalid direction '${opts.direction}'. Use 'to-parent' or 'to-fork'. What it means
`wmill workspace merge` accepts a `--direction` flag limited to 'to-parent' or 'to-fork'. Any other non-empty value fails validation after the merge computation steps; omitting it falls back to 'to-parent' with --yes or an interactive prompt.
Source
Thrown at cli/src/commands/workspace/merge.ts:382
const isConflict = d.ahead > 0 && d.behind > 0;
return [
String(i + 1),
d.kind,
d.path,
d.ahead > 0 ? colors.green(String(d.ahead)) : "0",
d.behind > 0 ? colors.yellow(String(d.behind)) : "0",
isConflict ? colors.red("YES") : "",
];
})
)
.render();
// 6. Determine direction
let direction: "to-parent" | "to-fork";
if (opts.direction === "to-parent" || opts.direction === "to-fork") {
direction = opts.direction;
} else if (opts.direction) {
throw new Error(
`Invalid direction '${opts.direction}'. Use 'to-parent' or 'to-fork'.`
);
} else if (opts.yes) {
direction = "to-parent";
} else {
const { Select } = await import("@cliffy/prompt/select");
direction = (await Select.prompt({
message: "Deploy direction:",
options: [
{
name: `Deploy to parent (${parentWorkspaceId}) ← fork changes`,
value: "to-parent",
},
{
name: `Update fork (${forkWorkspaceId}) ← parent changes`,
value: "to-fork",
},
],View on GitHub (pinned to e474e8803c)
Solutions
- Use exactly `--direction to-parent` or `--direction to-fork`
- Omit the flag and use `--yes` (defaults to to-parent) or answer the interactive prompt
- Check `wmill workspace merge --help` for accepted values
Example fix
// before wmill workspace merge --direction toParent // after wmill workspace merge --direction to-parent
Defensive patterns
Strategy: validation
Validate before calling
const VALID = ['to-parent', 'to-fork'] as const;
if (opts.direction && !VALID.includes(opts.direction as any)) {
throw new Error(`--direction must be one of ${VALID.join('|')}`);
} Type guard
function isValidDirection(d: unknown): d is 'to-parent' | 'to-fork' {
return d === 'to-parent' || d === 'to-fork';
} Try / catch
try {
await mergeWorkspaces(opts);
} catch (e) {
if (e.message.startsWith('Invalid direction')) {
log.error('Use --direction to-parent or to-fork.');
} else throw e;
} Prevention
- Only pass the exact literals to-parent/to-fork
- Omit --direction and rely on --yes default or the prompt in ambiguous cases
- Pin flag values in scripts rather than interpolating free-form input
When it happens
Trigger: Passing e.g. `wmill workspace merge --direction parent-to-fork` or a typo like `toParent`; any `opts.direction` not exactly 'to-parent' or 'to-fork'.
Common situations: Typos or casing mistakes in scripts; assuming other direction aliases exist; copy-pasting flag values from other CLIs.
Understand the failure class
Background: "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools — this error's family across 24 libraries.
Related errors
- file path must refer to a file.
- file path must refer to a file.
- --from-branch is for converting a *different* working branch
- Could not resolve workspace from branch name. Make sure you
- Workspace '${forkWorkspaceId}' is not a fork (no parent_work
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/f16bb9fcd491427f.
Report an issue: GitHub.