Skip to content

nix repl: fromJSON => Error => tabcomplete => crash #15133

@tromshusky

Description

@tromshusky

Describe the bug

When you tab-complete some variables containing errors in nix-repl, the repl crashes. Happens with builtins.fromJSON, but possibly otherwise too.

Steps To Reproduce

[user@nixos:~]$ nix repl
nix-repl> err1 = builtins.fromJSON "nixnix"
nix-repl> err1.<TAB>

error:
       … while calling the 'fromJSON' builtin
         at «string»:1:2:
            1|  builtins.fromJSON "nixnix"
             |  ^

       … while decoding a JSON string

       error: [json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid literal; last read: 'ni'

[user@nixos:~]$

the text input in the resulting shell is invisible too.

Expected behavior

handling the Error internally without crashing nix repl

[user@nixos:~]$ nix repl
nix-repl> err1 = builtins.fromJSON "nixnix"
nix-repl> err1.<TAB>

error:
       … while calling the 'fromJSON' builtin
         at «string»:1:2:
            1|  builtins.fromJSON "nixnix"
             |  ^

       … while decoding a JSON string

       error: [json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid literal; last read: 'ni'

nix-repl> err1.

Metadata

nix-env (Nix) 2.31.3

Additional context

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions