Skip to content

fix(@angular/cli): handle modern yarn registry error output and 404 detection - #34606

Merged
alan-agius4 merged 2 commits into
angular:mainfrom
MeAkib:fix/yarn-modern-registry-errors
Oct 30, 2026
Merged

alan-agius4 merged 2 commits into
angular:mainfrom
MeAkib:fix/yarn-modern-registry-errors

Conversation

@MeAkib

@MeAkib MeAkib commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Modern yarn (v2+) reports registry errors as JSON lines on stdout, one per message line, such as {"type":"error","displayName":"YN0035","data":"Package not found"} followed by a Response Code: 404 (Not Found) line. Because parseNpmLikeError did not recognize this format, querying a package that does not exist under modern yarn threw the original Process exited with code 1. error instead of returning null.

Add a parseYarnModernError parser for the modern yarn descriptor that reads these JSON lines and returns the HTTP status as the error code, so not-found responses are normalized to E404.

…etection

Modern yarn (v2+) reports registry errors as JSON lines on `stdout`, one per
message line, such as `{"type":"error","displayName":"YN0035","data":"Package
not found"}` followed by a `Response Code: 404 (Not Found)` line. Because
`parseNpmLikeError` did not recognize this format, querying a package that does
not exist under modern yarn threw the original `Process exited with code 1.`
error instead of returning `null`.

Add a `parseYarnModernError` parser for the modern yarn descriptor that reads
these JSON lines and returns the HTTP status as the error code, so not-found
responses are normalized to `E404`.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new parseYarnModernError parser to extract structured error information from modern Yarn (v2+) output, mapping registry errors to standardized error codes (e.g., E404). It also updates the package manager descriptor and adds comprehensive unit tests. The review feedback suggests two improvements: filtering out empty strings when constructing the error detail to prevent returning a string of newlines, and optimizing the status code search loop to avoid unnecessary allocations and short-circuit early.

@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Oct 30, 2026
@alan-agius4
alan-agius4 requested a review from clydin October 30, 2026 13:01
@clydin clydin removed the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 30, 2026
@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Oct 30, 2026
@alan-agius4
alan-agius4 merged commit a9aaff5 into angular:main Oct 30, 2026
42 checks passed
@alan-agius4

Copy link
Copy Markdown
Collaborator

This PR was merged into the repository. The changes were merged into the following branches:

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

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/cli target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants