Invalid import is not reported and it breaks the eval plugin
My environment
OS: MacOS GHC 9.10.1 from ghcup Project: https://github.com/noughtmare/tmp.oYnk68xwKl LSP client: VS Codium+vscode-haskell HLS: 2.9.0.1 from ghcup No special configuration
Steps to reproduce
- open
app/Main.hs - wait until HLS finishes loading
- (optional) click the
Evaluate...action
Expected behaviour
First of all, of course there is an obvious error in the project: the Foo module is not listed in the cabal file. This issue is about how HLS functions in spite of that error.
I expect an error on the line import Foo in app/Main.hs, because that module is not valid in the cabal package. Furthermore, clicking the Evaluate... action should either work without problems or it would also be acceptable if the action was not shown in the first place.
Actual behaviour
HLS reports no errors in app/Main.hs. Clicking the Evaluate... action results in a cryptic error:
eval: Internal Error: BadDependency "GhcSessionDeps"
Debug information
2025-02-05T09:27:43.927413Z | Error | eval: Internal Error: BadDependency "GhcSessionDeps"
[Error - 10:27:43] Request workspace/executeCommand failed.
Message: eval: Internal Error: BadDependency "GhcSessionDeps"
Code: -32603
I have same issue with GHC 9.4.8 and GHC 9.6.7 versions and HLS: 2.10.0.0 from ghcup
For reference, this is the debug log I get when running GHC 910, HLS on master:
2025-04-23T18:08:06.640684Z | Debug | Finished: eval.getUriContents Took: 0.00s
2025-04-23T18:08:06.641450Z | Debug | Finished build session
AsyncCancelled
HasCallStack backtrace:
collectBacktraces, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:92:13 in ghc-internal:GHC.Internal.Exception
toExceptionWithBacktrace, called at libraries/ghc-internal/src/GHC/Internal/IO.hs:260:11 in ghc-internal:GHC.Internal.IO
throwIO, called at libraries/ghc-internal/src/GHC/Internal/Control/Exception/Base.hs:195:43 in ghc-internal:GHC.Internal.Control.Exception.Base
2025-04-23T18:08:06.641726Z | Debug | Restarting build session due to Eval
Action Queue: []
Keys: [IsEvaluating; /home/dominik/scratch/tmp.oYnk68xwKl/app/Main.hs]
Aborting previous build session took 0.00s
2025-04-23T18:08:06.642462Z | Debug | Finished: runEvalCmd Took: 0.00s
2025-04-23T18:08:06.643136Z | Debug | Finished build session
AsyncCancelled
HasCallStack backtrace:
collectBacktraces, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:92:13 in ghc-internal:GHC.Internal.Exception
toExceptionWithBacktrace, called at libraries/ghc-internal/src/GHC/Internal/IO.hs:260:11 in ghc-internal:GHC.Internal.IO
throwIO, called at libraries/ghc-internal/src/GHC/Internal/Control/Exception/Base.hs:195:43 in ghc-internal:GHC.Internal.Control.Exception.Base
2025-04-23T18:08:06.643294Z | Debug | Restarting build session due to Eval
Action Queue: []
Keys: [IsEvaluating; /home/dominik/scratch/tmp.oYnk68xwKl/app/Main.hs]
Aborting previous build session took 0.00s
2025-04-23T18:08:06.643583Z | Error | eval: Internal Error: BadDependency "GhcSessionDeps"
(Not very helpful).
Hello. Any updates on this?
@dschrempf is it a multi-folder workspace for you?