Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Biome CLI fails when run in a background process #4988

Open
1 task done
lwileczek opened this issue Jan 28, 2025 · 3 comments
Open
1 task done

🐛 Biome CLI fails when run in a background process #4988

lwileczek opened this issue Jan 28, 2025 · 3 comments
Labels
A-CLI Area: CLI S-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project

Comments

@lwileczek
Copy link

Environment information

CLI:
  Version:                      1.9.4
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           macos

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v22.10.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/10.9.0"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 true

Workspace:
  Open Documents:               0

What happened?

Computer

macOS 14.6.1
Intel Macbook pro 2019

Issue

Running biome in the background caused a crash report.

Biome encountered an unexpected error

This is a bug in Biome, not an error in your code, and we would appreciate it if you could report it to https://github.com/biomejs/biome/issues/ along with the following information to help us fixing the issue:

Source Location: crates/biome_console/src/lib.rs:151:23
Thread Name: main
Message: called `Result::unwrap()` on an `Err` value: Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }

node:events:497
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at afterWriteDispatched (node:internal/stream_base_commons:161:15)
    at writeGeneric (node:internal/stream_base_commons:152:3)
    at Socket._writeGeneric (node:net:954:11)
    at Socket._write (node:net:966:8)
    at writeOrBuffer (node:internal/streams/writable:570:12)
    at _write (node:internal/streams/writable:499:10)
    at Writable.write (node:internal/streams/writable:508:10)
    at console.value (node:internal/console/constructor:310:16)
    at console.log (node:internal/console/constructor:385:26)
    at ConsumerObserver2.next (/nix/store/h55n0rdlpb2ih6ibm34ickmkmdf6bjlc-pnpm-9.12.3/libexec/pnpm/dist/pnpm.cjs:23454:29)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}

Node.js v20.18.0

justfile used to execute biome

fmt:
    @ ( gosimports -w . & gofumpt -l -w . & pnpm run fmt ) | wait -n

package.json script

{
  "scripts": {
    "fmt": "biome format --write ./src"
  },
}

I go the same error when running npx biome rage | pbcopy.

Biome encountered an unexpected error

This is a bug in Biome, not an error in your code, and we would appreciate it if you could report it to https://github.com/biomejs/biome/issues/ along with the following information to help us fixing the issue:

Source Location: crates/biome_console/src/lib.rs:149:14
Thread Name: main
Message: called `Result::unwrap()` on an `Err` value: Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }

This appears to happen when I'm in a nix shell.

let
nixpkgs = import (builtins.fetchTarball {
    url = "https://github.com/NixOS/nixpkgs/archive/8d48200ead5adea71485965f92405575c66dab04.tar.gz";
    sha256 = "0qwjl64ylbyj8bz58yff52pa6c35zss6wrk1gcywcm9j96g6d1cr";
    }) {
      overlays = [];
      config = {};
};

in
with nixpkgs;

stdenv.mkDerivation {
  name = "myproj";
  buildInputs = [];

  nativeBuildInputs = [
    #Project requirements
    nodejs_22
    postgresql_16
    pnpm
    awscli2
    go
    goose # Database migrations

    # To use SQLITE
    gcc
    openssl
    sqlite

    # SCM
    git
    gnupg # To sign commits
    openssh # Connect to git over ssh

    # Developer preferences
    eza # Add color to LS
    ripgrep # grep but don't check hidden dirs
    fd # hella fast find for use with nvim telescope
    fzf # fuzzy text search 
    tree-sitter # to use with nvim when files not seen before
    just  # Task runner

    # common cli utils
    wget
    curl
    less
    unzip

    # Go Tools!
    gopls
    gofumpt
    gosimports
    golangci-lint

    # I heart neovim
    neovim
    vimPlugins.nvim-lspconfig
    vimPlugins.trouble-nvim
    vimPlugins.mason-nvim
    vimPlugins.mason-lspconfig-nvim
    vimPlugins.nvim-fzf
    vimPlugins.luasnip
    vimPlugins.null-ls-nvim
    vimPlugins.nvim-treesitter
    vimPlugins.nvim-treesitter-context
    vimPlugins.nvim-treesitter-parsers.just
    vimPlugins.nvim-treesitter-parsers.go
    vimPlugins.nvim-treesitter-parsers.jsonc
    vimPlugins.nvim-treesitter-parsers.json
    vimPlugins.nvim-treesitter-parsers.tsx
    vimPlugins.nvim-treesitter-parsers.sql
    vimPlugins.nvim-treesitter-parsers.nix
    vimPlugins.nvim-treesitter-parsers.typescript
    vimPlugins.nvim-treesitter-parsers.javascript
  ];

  CGO_ENABLED=1;
  CC="gcc";
  EDITOR="nvim";
}

Expected result

It should not throw an error saying it crashed from a broken pipe. I assume it has something to do with the nix environment but I'm not sure what you would need. I reported because the error message said to.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@lwileczek lwileczek added the S-Needs triage Status: this issue needs to be triaged label Jan 28, 2025
@dyc3 dyc3 added the S-Needs repro Status: needs a reproduction label Jan 28, 2025
Copy link
Contributor

Hello @lwileczek, please provide a minimal reproduction. You can use one of the following options:

  • Provide a link to our playground, if it's applicable.
  • Provide a link to GitHub repository. To easily create a reproduction, you can use our interactive CLI via npm create @biomejs/biome-reproduction

Issues marked with S-Needs repro will be closed if they have no activity within 3 days.

@github-actions github-actions bot removed the S-Needs triage Status: this issue needs to be triaged label Jan 28, 2025
@arendjr
Copy link
Contributor

arendjr commented Jan 30, 2025

I’m inclined to say all information needed to reproduce is already in the issue. The output points us exactly to where the problem is:

Source Location: crates/biome_console/src/lib.rs:149:14
Thread Name: main
Message: called `Result::unwrap()` on an `Err` value: Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }

And a command for reproduction is provided: npx biome rage | pbcopy

@arendjr arendjr added good first issue Good for newcomers S-Help-wanted Status: you're familiar with the code base and want to help the project A-CLI Area: CLI and removed S-Needs repro Status: needs a reproduction labels Jan 30, 2025
@ematipico ematipico added S-Bug-confirmed Status: report has been confirmed as a valid bug and removed good first issue Good for newcomers labels Jan 30, 2025
@ematipico
Copy link
Member

I skimmed the code, and it doesn't sound like a very beginner friendly bug to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: CLI S-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project
Projects
None yet
Development

No branches or pull requests

4 participants