Skip to content

Stop init from crashing when the team list is empty - #8531

Open
Hashim1999164 wants to merge 1 commit into
netlify:mainfrom
Hashim1999164:fix/empty-team-list-on-init
Open

Hashim1999164 wants to merge 1 commit into
netlify:mainfrom
Hashim1999164:fix/empty-team-list-on-init

Conversation

@Hashim1999164

@Hashim1999164 Hashim1999164 commented Sep 26, 2026 •

Copy link
Copy Markdown

Fixes #8355

netlify init with the manual flag asks for a team through an inquirer list. When the account list is empty that prompt reads value on undefined and the command crashes.

The non interactive path already reports that there are no teams. Interactive project create now checks that first so it exits with the same message instead of opening an empty list.

@Hashim1999164
Hashim1999164 requested a review from a team as a code owner September 26, 2026 00:12
@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: f3d3d2cd-adaf-4ec2-8185-234ea2d8dc7d

📥 Commits

Reviewing files that changed from the base of the PR and between 2c4c744 and d7880fa.

📒 Files selected for processing (2)
  • src/commands/sites/sites-create.ts
  • tests/unit/commands/sites/sites-create.test.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Interactive site creation now reports a clear “No teams available” error when no teams can be selected, instead of opening a team prompt.
    • Team selection validates that teams are available before proceeding, including when teams are missing or the list is empty.
    • Non-interactive team selection also reports an error when no teams are available.

Walkthrough

The change adds requireTeams to reject missing or empty account lists with the existing “No teams available” error. Non-interactive team resolution uses the helper. Interactive site creation validates accounts before opening the team prompt. Unit tests cover validation, team resolution, and the no-accounts interactive path.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: jherr

Merge Risk: ⚪ Minimal · up to d7880

The empty-team path is guarded before the prompt opens. No actionable merge risk remains beyond normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: preventing netlify init --manual from crashing when no teams are available.
Description check ✅ Passed The description accurately explains the empty-team failure, the interactive prompt issue, and the guard added to match the non-interactive behavior.
Linked Issues check ✅ Passed Issue [#8355] requires netlify init --manual to handle an empty team list without opening an empty selection prompt. sitesCreate calls requireTeams before the interactive selector. `requireTeams…
Out of Scope Changes check ✅ Passed The changes stay within issue [#8355]. The shared requireTeams helper and the non-interactive refactor centralize existing empty-team validation. The added tests cover the interactive regression and…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@Hashim1999164
Hashim1999164 force-pushed the fix/empty-team-list-on-init branch from 2c4c744 to d7880fa Compare October 2, 2026 21:34
@Hashim1999164

Copy link
Copy Markdown
Author

rebased onto latest main. the empty team list guard is wired through the new @inquirer/prompts select path now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

netlify init --manual cannot read team and crashes

1 participant