Skip to content

Invalid import is not reported and it breaks the eval plugin #4487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
noughtmare opened this issue Feb 5, 2025 · 2 comments
Open

Invalid import is not reported and it breaks the eval plugin #4487

noughtmare opened this issue Feb 5, 2025 · 2 comments
Labels
component: ghcide component: hls-eval-plugin type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@noughtmare
Copy link
Contributor

noughtmare commented Feb 5, 2025

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

  1. open app/Main.hs
  2. wait until HLS finishes loading
  3. (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 
@noughtmare noughtmare added status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Feb 5, 2025
@lambdajon
Copy link

lambdajon commented Apr 23, 2025

I have same issue with GHC 9.4.8 and GHC 9.6.7 versions and HLS: 2.10.0.0 from ghcup

@dschrempf
Copy link
Contributor

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: ghcide component: hls-eval-plugin type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

4 participants