Skip to content

IR evaluation error 20250413 #15561

@kkoang

Description

@kkoang

I tried to write the code according to the content of https://www.nushell.sh/lang-guide/chapters/pipelines.html#examples-for-subexpression, but I got an error after running it.

# scmd.nu
def main [
    p1: string
] {
    $p1 | print -n
    $"{($p1)}" | print -en
}

Running the following content in nushell will cause an error.

alias cmd1 = nu scmd.nu c1
alias cmd2 = nu scmd.nu c2
alias cmd3 = nu scmd.nu c3
alias cmd4 = nu scmd.nu c4
(cmd1 | cmd2; cmd3 | cmd4) o> test.out # Error
(cmd1 | cmd2; cmd3 | cmd4) e> test.out # Error
(cmd1 | cmd2; cmd3 | cmd4) o+e> test.out # Error

Error message

~> (cmd1 | cmd2; cmd3 | cmd4) o> test.out
{c1}c2{c2}{c3}{c4}Error: nu::shell::ir_eval_error

  × IR evaluation error: Tried to write to file #0, but it is not open
   ╭─[entry #5:1:28]
 1 │ (cmd1 | cmd2; cmd3 | cmd4) o> test.out
   ·                            ─┬
   ·                             ╰── while running this code
   ╰────
  help: this is a bug, please report it at https://github.com/nushell/nushell/issues/new along with the code you were
        running if able

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions