fix: hard crash in commands when no API provided#2813
Merged
Conversation
🦋 Changeset detectedLatest commit: fb35285 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
Contributor
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||
tatomyr
reviewed
May 14, 2026
|
|
||
| const apis = await getFallbackApisOrExit(argv.api ? [argv.api] : [], config); | ||
|
|
||
| if (!apis.length) { |
Collaborator
There was a problem hiding this comment.
Please also look if other commands have the same problem.
Contributor
Author
There was a problem hiding this comment.
score and stats also hard crashed, when no API's were provided and bundle silently failed. I decided to move exitWithError in getFallbackApisOrExit function.
build-docs command when no API provided
JLekawa
reviewed
May 14, 2026
JLekawa
approved these changes
May 14, 2026
JLekawa
reviewed
May 14, 2026
tatomyr
approved these changes
May 14, 2026
Co-authored-by: Andrew Tatomyr <andrew.tatomyr@redocly.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What/Why/How?
Fixed a hard crash in
build-docs,stats, andscorewhen no API was provided either via the command argument or in the config. These commands — along withbundle, which previously exited silently with no output — now exit with a clear, consistent error message pointing the user to the missing input.Reference
Testing
Locally
Screenshots (optional)
Before:

After:

Check yourself
Security
Note
Low Risk
Low risk: centralizes an existing validation case into
getFallbackApisOrExitwith a clearer message, affecting only CLI argument/config error handling paths.Overview
Prevents CLI commands that rely on
getFallbackApisOrExitfrom proceeding with an empty API list by makinggetFallbackApisOrExitexit with a clear, consistent message when neither CLI args nor config define any APIs.Removes redundant
!apis.lengthchecks fromlintandscorecard-classic, updates tests accordingly, and adds a changeset for a patch release.Reviewed by Cursor Bugbot for commit fb35285. Bugbot is set up for automated code reviews on this repo. Configure here.