Haskell-ide-engine: Ghc error on cradle initialisation: "cannot satisfy -package-id ...

Created on 5 Mar 2020  路  10Comments  路  Source: haskell/haskell-ide-engine

When opening project https://github.com/mrkafk/helloworld in VSCode, I keep getting errors like in title. HIE log below.

My settings.json:

"languageServerHaskell.logFile": "/tmp/hie.log",
"languageServerHaskell.hieExecutablePath": "/home/user/.local/bin/hie-8.6.5",
"languageServerHaskell.liquidOn": true,
"haskell.hlint.executablePath": "/home/user/.local/bin/hlint"

HIE log:

2020-03-05 17:58:04.712030202 [ThreadId 4] - Run entered for HIE(hie-8.6.5) Version 1.1, Git revision 6afa461899c2c5d448fd1b452c2f8b4c3883e917 (3769 commits) x86_64 ghc-8.6.5
2020-03-05 17:58:04.712361243 [ThreadId 4] - Operating as a LSP server on stdio
2020-03-05 17:58:04.712420243 [ThreadId 4] - Current directory:/home/user/haskell/helloworld
2020-03-05 17:58:04.712467367 [ThreadId 4] - Operating system:linux
2020-03-05 17:58:04.712520867 [ThreadId 4] - args:["--lsp","-l","/tmp/hie.log"]
2020-03-05 17:58:04.745837661 [ThreadId 4] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/home/user/haskell/helloworld/stack.yaml"}
2020-03-05 17:58:05.938937635 [ThreadId 4] - Module "/home/user/haskell/helloworld/File.hs" is loaded by Cradle: Cradle {cradleRootDir = "/home/user/haskell/helloworld", cradleOptsProg = CradleAction: Other Stack}
2020-03-05 17:58:05.939238801 [ThreadId 4] - Executing Stack GHC with args: --numeric-version
2020-03-05 17:58:06.192089701 [ThreadId 29] - Executing Stack GHC with args: --print-libdir
2020-03-05 17:58:06.49746245 [ThreadId 34] - New cradle: /home/user/haskell/helloworld/app/Main.hs
2020-03-05 17:58:06.498397613 [ThreadId 34] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/home/user/haskell/helloworld/stack.yaml"}
2020-03-05 17:58:07.677604889 [ThreadId 34] - Module "/home/user/haskell/helloworld/app/Main.hs" is loaded by Cradle: Cradle {cradleRootDir = "/home/user/haskell/helloworld", cradleOptsProg = CradleAction: Other Stack}
2020-03-05 17:58:07.677781805 [ThreadId 34] - Found cradle: Cradle {cradleRootDir = "/home/user/haskell/helloworld", cradleOptsProg = CradleAction: Other Stack}
2020-03-05 17:58:08.819239136 [ThreadId 60] - Ghc error on cradle initialisation: "cannot satisfy -package-id helloworld-0.1.0.0-5AFk17aNCLW4CrcpWxCXgp\n    (use -v for more information)"
2020-03-05 17:58:08.819372302 [ThreadId 34] - ghcDispatcher:Got error for a request: IdeError {ideCode = OtherError, ideMessage = "\"cannot satisfy -package-id helloworld-0.1.0.0-5AFk17aNCLW4CrcpWxCXgp\\n    (use -v for more information)\"", ideInfo = Null} with mid: Nothing
2020-03-05 17:58:08.819537801 [ThreadId 34] - New cradle: /home/user/haskell/helloworld/app/Main.hs
2020-03-05 17:58:08.820886213 [ThreadId 34] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/home/user/haskell/helloworld/stack.yaml"}
2020-03-05 17:58:10.020385789 [ThreadId 34] - Module "/home/user/haskell/helloworld/app/Main.hs" is loaded by Cradle: Cradle {cradleRootDir = "/home/user/haskell/helloworld", cradleOptsProg = CradleAction: Other Stack}
2020-03-05 17:58:10.020576205 [ThreadId 34] - Found cradle: Cradle {cradleRootDir = "/home/user/haskell/helloworld", cradleOptsProg = CradleAction: Other Stack}
2020-03-05 17:58:10.419253859 [ThreadId 88] - Ghc error on cradle initialisation: "cannot satisfy -package-id helloworld-0.1.0.0-5AFk17aNCLW4CrcpWxCXgp\n    (use -v for more information)"
2020-03-05 17:58:10.419462234 [ThreadId 34] - ghcDispatcher:Got error for a request: IdeError {ideCode = OtherError, ideMessage = "\"cannot satisfy -package-id helloworld-0.1.0.0-5AFk17aNCLW4CrcpWxCXgp\\n    (use -v for more information)\"", ideInfo = Null} with mid: Nothing

stack clean and stack build do not help.

bug can-workaround cabal-helper

Most helpful comment

Unfortunately, that is a known error, duplicate of #1608
Sorry, you are running into this.
Work around: provide a custom hie.yaml. In your particular case,

cradle:
  stack:

Should suffice. For more complex hie.yaml configurations take a look at https://github.com/haskell/haskell-ide-engine/#project-configuration

All 10 comments

Hi! Your package.yaml states the lib modules should be inside the src subdir but i dont see Lib.hs in the log.
Maybe you need to add a exposed-modules field in the library section?
Does stack build work without errors?

stack build runs without problems. The program executes. I still get the error.

P.S. I created the project by stack new helloworld new-template. After that I just adjusted stack.yaml with resolver: lts-14.2.

Unfortunately, that is a known error, duplicate of #1608
Sorry, you are running into this.
Work around: provide a custom hie.yaml. In your particular case,

cradle:
  stack:

Should suffice. For more complex hie.yaml configurations take a look at https://github.com/haskell/haskell-ide-engine/#project-configuration

Well, in my case i've reproduced the error at first but after a stack build and restart vscode, hie loads the app/Main.hs correctly.
The behaviour is reproducible:

  • Delete .stack-work and $(stack path --snapshot-install-root)
  • Open in vscode Main.hs ---> error
  • stack build
  • Reopen vscode in the Main.hs file --> works

Yeah, it is on and off. I think somewhere we found a semi reproducible set of steps. But it is definitely related to cabal-helper and stack.

@mrkafk did you experience that behaviour? in my case after running stack build and restarting hie, the Main.hs file is loaded succesfully

Hello Javier,

Thank you for looking into this problem!

Anyway, I reproduced your steps and it worked indeed. At first.

Then I started writing another function in Main.hs and the weird thing happened: while autocompletion works, e.g. when starting to type "put.." (StrLn autocompletion popping up), now the same original error keeps popping up. This does not prevent HIE from working however, at least in basic sense.

@fendor Your workaround works fine. Thank you!

@mrkafk ok, so i'll close this one if you dont mind and we will tracking this in #1608

Was this page helpful?
0 / 5 - 0 ratings