windmill-labs/windmill · error

Multiple repositories found: ${repoPaths.join(", ")}. Use --

Error message

Multiple repositories found: ${repoPaths.join(", ")}. Use --repository to specify which one to ${operation || "use"}.

What it means

When a workspace has multiple git-sync repositories and the CLI session is non-interactive (no TTY), `selectRepository` cannot prompt for a choice, so it throws listing all repository paths and tells the caller to pass `--repository`.

Source

Thrown at cli/src/utils/utils.ts:266

  }

  if (repositories.length === 1) {
    const repoPath = repositories[0].git_repo_resource_path.replace(
      /^\$res:/,
      ""
    );
    log.info(colors.cyan(`Auto-selected repository: ${colors.bold(repoPath)}`));
    return repositories[0];
  }

  // Check if we're in a non-interactive environment
  const isInteractive = !!process.stdin.isTTY && !!process.stdout.isTTY;

  if (!isInteractive) {
    const repoPaths = repositories.map((r) =>
      r.git_repo_resource_path.replace(/^\$res:/, "")
    );
    throw new Error(
      `Multiple repositories found: ${repoPaths.join(
        ", "
      )}. Use --repository to specify which one to ${operation || "use"}.`
    );
  }

  // Import Select dynamically to avoid dependency issues
  const { Select } = await import("@cliffy/prompt/select");

  console.log(
    `\nMultiple repositories found. Please select which repository to ${
      operation || "use"
    }:\n`
  );

  const selectedRepo = await Select.prompt({
    message: `Select repository for ${operation || "operation"}:`,
    options: repositories.map((repo, index) => {

View on GitHub (pinned to e474e8803c)

Solutions

  1. Pass the repository explicitly: add `--repository <repo-path>` to the command
  2. Run in an interactive terminal to get the selection prompt
  3. Remove or consolidate unused repositories so only one remains (then selection is automatic)

Example fix

// before (CI, non-interactive)
wmill git-sync pull
// Multiple repositories found: repo_a, repo_b ...
// after
wmill git-sync pull --repository repo_a
Defensive patterns

Strategy: validation

Validate before calling

const repos = await client.listGitSyncRepositories();
if (repos.length > 1 && !process.stdout.isTTY && !process.env.CI_REPO_FLAG_SET) {
  throw new Error('Non-interactive session with multiple repos: pass --repository <path>');
}

Try / catch

try {
  await runGitSyncCommand();
} catch (e) {
  if (e.message.startsWith('Multiple repositories found:')) {
    const first = e.message.match(/found: ([^.]*)/)?.[1].split(', ')[0];
    console.error(`Re-run with --repository ${first} (or your choice).`);
  } else throw e;
}

Prevention

When it happens

Trigger: Running any repository-scoped CLI command with 2+ repositories configured while stdin/stdout are not TTYs (CI pipelines, scripts, piped output), without the `--repository` flag.

Common situations: CI/CD jobs (GitHub Actions, GitLab CI) after a second repo was added to the workspace; running the CLI under a wrapper that hides the TTY.

Related errors


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