AesonException "Error in $['system-info']: key \"os\" not present"

stack install pandoc
Downloaded lts-14.20 build plan.
AesonException “Error in $[‘system-info’]: key “os” not present”

What is this Exception telling me? Is pandoc installed? Or is there a system error?

I ran into this one some time ago but I don’t recall how I fixed it. But in general Stack sometimes breaks and deleting your “~/.stack” or “.stack-work” folders might help get it unstuck.

Well the ~/.stack is still there a ./stack-work I don’t have that

@Crojav what version of Stack are you using? This looks like Stack 1.x and with LTS-14 stackage snapshots we trimmed a bit getting rid of some details which are either were not used anymore or not used in Stack 2.

$ stack --version
Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) x86_64 hpack-0.31.2
$ ghci
GHCi, version 8.0.2: :? for help
Prelude> import Text.Pandoc
Prelude Text.Pandoc>

I see y 1.5.1 was mentioned in Started with Haskell - And what did I find? and the error above looks like something from that version. With Stack 2 you shouldn’t have this. BTW posting full verbose Stack log (you could set it with -v) could be very helpful.

I got the same exception
AesonException "Error in $['system-info']: key \"os\" not present"
upon trying to run stack test.

stack --version
Version 1.5.1 x86_64

So from what you say I should get stack 2 but being somehow new to Haskell and GHCI I’m not sure how to do this. Anyone could link me to a step by step process?

I tried :
sudo apt-get update && sudo apt-get install stack -y
and got
E: Unable to locate package stack

Try running stack upgrade

Cheers gilmi, it worked fine.

Just in case others come across the same issue, here’s the step-by-step:

$ stack upgrade(as advised)
$New stack executable available at somePath
$ cd ~/.somePath
$ stack init

1 Like

You probably don’t want to cd into ~/.somePath to run stack init. just make sure it is in your path and work elsewhere.

1 Like

Okay, thanks for the information. I just ran the init from there and then shifted back to my working dir.
So i should have initialized the stack directly from my working dir?

Stack init is used when you want use stack on an already existing cabal project. If you want to create a new project (from anywhere on your machine, I like to have my haskell projects at ~/code/haskell) you can use stack new instead.

See the user guide: