{"record":{"id":"f16bb9fcd491427f","repo":"windmill-labs/windmill","slug":"invalid-direction-opts-direction-use-to-par","errorCode":null,"errorMessage":"Invalid direction '${opts.direction}'. Use 'to-parent' or 'to-fork'.","messagePattern":"Invalid direction '(.+?)'\\. Use 'to-parent' or 'to-fork'\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/workspace/merge.ts","lineNumber":382,"sourceCode":"        const isConflict = d.ahead > 0 && d.behind > 0;\n        return [\n          String(i + 1),\n          d.kind,\n          d.path,\n          d.ahead > 0 ? colors.green(String(d.ahead)) : \"0\",\n          d.behind > 0 ? colors.yellow(String(d.behind)) : \"0\",\n          isConflict ? colors.red(\"YES\") : \"\",\n        ];\n      })\n    )\n    .render();\n\n  // 6. Determine direction\n  let direction: \"to-parent\" | \"to-fork\";\n  if (opts.direction === \"to-parent\" || opts.direction === \"to-fork\") {\n    direction = opts.direction;\n  } else if (opts.direction) {\n    throw new Error(\n      `Invalid direction '${opts.direction}'. Use 'to-parent' or 'to-fork'.`\n    );\n  } else if (opts.yes) {\n    direction = \"to-parent\";\n  } else {\n    const { Select } = await import(\"@cliffy/prompt/select\");\n    direction = (await Select.prompt({\n      message: \"Deploy direction:\",\n      options: [\n        {\n          name: `Deploy to parent (${parentWorkspaceId}) ← fork changes`,\n          value: \"to-parent\",\n        },\n        {\n          name: `Update fork (${forkWorkspaceId}) ← parent changes`,\n          value: \"to-fork\",\n        },\n      ],","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/workspace/merge.ts#L364-L400","documentation":"`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.","triggerScenarios":"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'.","commonSituations":"Typos or casing mistakes in scripts; assuming other direction aliases exist; copy-pasting flag values from other CLIs.","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"],"exampleFix":"// before\nwmill workspace merge --direction toParent\n// after\nwmill workspace merge --direction to-parent","handlingStrategy":"validation","validationCode":"const VALID = ['to-parent', 'to-fork'] as const;\nif (opts.direction && !VALID.includes(opts.direction as any)) {\n  throw new Error(`--direction must be one of ${VALID.join('|')}`);\n}","typeGuard":"function isValidDirection(d: unknown): d is 'to-parent' | 'to-fork' {\n  return d === 'to-parent' || d === 'to-fork';\n}","tryCatchPattern":"try {\n  await mergeWorkspaces(opts);\n} catch (e) {\n  if (e.message.startsWith('Invalid direction')) {\n    log.error('Use --direction to-parent or to-fork.');\n  } else throw e;\n}","preventionTips":["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"],"tags":["cli","argument-validation","flag","workspace-merge"],"backgroundTag":"invalid-flag-value","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}