Skip to content

[Bug?]: Network error output should include status message (reason phrase) #6861

@candrews

Description

@candrews

Self-service

  • I'd be willing to implement a fix

Describe the bug

When a request fails, currently the output looks like this:

$ yarn install
➤ YN0000: · Yarn 4.9.2
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0035: │ unpopular-js@npm:1.0.12: The remote server failed to provide the requested resource
➤ YN0035: │   Response Code: 403 (Forbidden)
➤ YN0035: │   Request Method: GET
➤ YN0035: │   Request URL: https://repo.redacted.example.com/repository/npm-read-group/unpopular-js/-/unpopular-js-1.0.12.tgz
➤ YN0000: └ Completed in 6s 143ms
➤ YN0000: · Failed with errors in 6s 163ms

The status message / reason phrase would be really nice to also be output.

It appears there is intent to output the status message as prettyResponseCode method at

function prettyResponseCode({statusCode, statusMessage}: Response, configuration: Configuration) {
takes statusMessage as an input from the provided Response, but when that method is called at
value: formatUtils.tuple(formatUtils.Type.NO_HINT, prettyResponseCode(err.response, configuration)),
the statusMessage is not provided, which is why I'm calling this a bug (as the intent appears to be clear that the status message should be output but it is not actually output).

To reproduce

I have a proxy set up to block unpopular-js@1.0.12 for this test. Here's the package.json:

{
  "name": "@test/yarn-example",
  "version": "0.0.1",
  "description": "",
  "dependencies": {
    "react": "^19.0.0",
    "unpopular-js": "1.0.12"
  }
}

Environment

System:
    OS: Linux 6.15 Fedora Linux 42 (Workstation Edition)
    CPU: (12) x64 12th Gen Intel(R) Core(TM) i7-1255U
  Binaries:
    Node: 22.17.0 - /tmp/xfs-56ae242f/node
    Yarn: 4.9.2 - /tmp/xfs-56ae242f/yarn
    npm: 10.9.2 - /usr/bin/npm
    pnpm: 10.9.0 - /usr/bin/pnpm

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions