{"record":{"id":"dc862e7a189c5262","repo":"windmill-labs/windmill","slug":"branch-env-is-deprecated-use-workspace","errorCode":null,"errorMessage":"⚠️  --branch/--env is deprecated. Use --workspace instead.","messagePattern":"⚠️  --branch/--env is deprecated\\. Use --workspace instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cli/src/commands/sync/sync.ts","lineNumber":3552,"sourceCode":"  if ((opts as any).jsonOutput) log.setSilent(true);\n  const originalCliOpts = { ...opts };\n  opts = await mergeConfigWithConfigFile(opts);\n\n  // --include-secrets overrides skipSecrets from wmill.yaml\n  if ((originalCliOpts as any).includeSecrets) {\n    opts.skipSecrets = false;\n  }\n\n  // Resolve workspace name for config lookups.\n  // --branch resolves git branch → workspace name (deprecated but still supported).\n  // --workspace selects a workspace config entry by name when it matches one,\n  // regardless of --base-url. If it doesn't match any entry it's treated as a\n  // profile/credential selector only.\n  const hasExplicitCredentials = !!opts.baseUrl;\n  let wsNameForConfig: string | undefined;\n\n  if (opts.branch && !hasExplicitCredentials && !branchDeprecationWarned) {\n    log.warn(\"⚠️  --branch/--env is deprecated. Use --workspace instead.\");\n    branchDeprecationWarned = true;\n  }\n\n  wsNameForConfig = resolveWsNameForConfigFromFlags(opts);\n\n  if (!opts.branch && opts.workspace && !hasExplicitCredentials) {\n    // Warn if override doesn't match a config key, or mismatches the auto-detected branch\n    warnWorkspaceOverride(opts, opts.workspace);\n  }\n\n  // Validate workspace configuration early. Skip when ANY explicit flag is set\n  // (even a --workspace value that doesn't match a config key — the user opted\n  // out of branch-based auto-detection).\n  try {\n    await validateBranchConfiguration(opts, wsNameForConfig ?? opts.workspace);\n  } catch (error) {\n    if (error instanceof Error && error.message.includes(\"overrides\")) {\n      log.error(error.message);","sourceCodeStart":3534,"sourceCodeEnd":3570,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/sync/sync.ts#L3534-L3570","documentation":"A deprecation warning from the sync config-resolution code. The `--branch`/`--env` flags historically selected which workspace entry in wmill.yaml to use; they have been superseded by `--workspace`. Sync still works, but the flag will eventually be removed.","triggerScenarios":"Running `wmill sync pull`/`push` (or subcommands sharing this resolver) with `--branch <name>` or `--env <name>` and no --base-url (i.e. no explicit credentials), on the first such invocation in the process (branchDeprecationWarned gates repeats).","commonSituations":"Old CI scripts or docs written before the flag rename; muscle memory from older CLI versions; copy-pasted commands from stale README files.","solutions":["Replace `--branch <name>` with `--workspace <name>` in your command/scripts.","Update CI pipelines and documentation to use --workspace.","Verify the resolved workspace matches what --branch previously selected (`wmill workspace list`).","No immediate action required — behavior is unchanged; the warning is informational until removal."],"exampleFix":"// before\nwmill sync pull --branch prod\n// after\nwmill sync pull --workspace prod","handlingStrategy":"validation","validationCode":"if (args.includes(\"--branch\") || args.includes(\"--env\")) {\n  throw new Error(\"--branch/--env is deprecated; use --workspace\");\n}","typeGuard":"function usesDeprecatedSyncFlags(args: string[]): boolean {\n  return args.includes(\"--branch\") || args.includes(\"--env\");\n}","tryCatchPattern":"try {\n  await runSyncCommand(args);\n} catch (e) {\n  if (String(e).includes(\"deprecated\")) {\n    console.error(\"Update the script to use --workspace\");\n  } else throw e;\n}","preventionTips":["Grep CI configs and docs for `--branch`/`--env` in sync commands and migrate to --workspace.","Pin and periodically bump the CLI version; read changelogs for flag removals.","Centralize sync invocations in one wrapper script so the flag is fixed once."],"tags":["cli","deprecation","flags","sync"],"backgroundTag":"deprecated-flag","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"}