Skip to content

Prelude.head: empty list makes hls unusable until restart #1618

@codygman

Description

@codygman

Your environment

Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools:

~/work-repo $ haskell-language-server --probe-tools
haskell-language-server version: 1.0.0.0 (GHC: 8.10.4) (PATH: /nix/store/1ngys7bwknlk8mixh5x3cxzxpnzn83ya-haskell-language-server-1.0.0.0/bin/haskell-language-server)
Tool versions found on the $PATH
cabal:		3.0.0.0
stack:		2.5.1.1
ghc:		8.10.4

Which lsp-client do you use:
lsp-mode in emacs

Describe your project (alternative: link to the project):
n/a

Steps to reproduce

I'm not quite sure.

Expected behaviour

HLS should not die with a Prelude.head empty list error or at least report an error with call stack information

Actual behaviour

HLS seems "stuck" until restart

Include debug information

Execute in the root of your project the command haskell-language-server --debug . and paste the logs here:

I don't have time to take out information that I might be unable to share right now.

Debug output:
<paste your logs here>

Paste the logs from the lsp-client, e.g. for VS Code

LSP logs:
Found "/home/cody/work-proj/hie.yaml" for "/home/cody/work-proj/a"
Module "/home/cody/work-proj/a" is loaded by Cradle: Cradle {cradleRootDir = "/home/cody/work-proj", cradleOptsProg = CradleAction: Stack}
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 1.0.0.0 x86_64 ghc-8.10.4
Current directory: /home/cody/work-proj
Operating system: linux
Arguments: ["--lsp","-d","-l","/tmp/hls.log"]
Cradle directory: /home/cody/work-proj
Cradle type: Stack

Tool versions found on the $PATH
cabal:		3.0.0.0
stack:		2.5.1.1
ghc:		8.10.4


Consulting the cradle to get project GHC version...
Project GHC version: 8.10.4
haskell-language-server exe candidates: ["haskell-language-server-8.10.4","haskell-language-server-8.10","haskell-language-server"]
Launching haskell-language-server exe at:/run/current-system/sw/bin/haskell-language-server-8.10.4
haskell-language-server version: 1.0.0.0 (GHC: 8.10.4) (PATH: /nix/store/1ngys7bwknlk8mixh5x3cxzxpnzn83ya-haskell-language-server-1.0.0.0/bin/haskell-language-server)
Starting (haskell-language-server)LSP server...
  with arguments: LspArguments {argLSP = True, argsCwd = Nothing, argFiles = [], argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = True, argsLogFile = Just "/tmp/hls.log", argsThreads = 0, argsProjectGhcVersion = False}
  with plugins: [PluginId "brittany",PluginId "class",PluginId "eval",PluginId "floskell",PluginId "fourmolu",PluginId "ghcide-code-actions",PluginId "ghcide-completions",PluginId "ghcide-hover-and-symbols",PluginId "ghcide-type-lenses",PluginId "haddockComments",PluginId "hlint",PluginId "importLens",PluginId "moduleName",PluginId "ormolu",PluginId "pragmas",PluginId "retrie",PluginId "splice",PluginId "stylish-haskell",PluginId "tactic"]
  in directory: /home/cody/work-proj
If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!
Starting LSP server...
If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!
 Started LSP server in 0.00s
setInitialDynFlags cradle: Cradle {cradleRootDir = "/home/cody/work-proj", cradleOptsProg = CradleAction: Stack}
Output from setting up the cradle Cradle {cradleRootDir = "/home/cody/work-proj", cradleOptsProg = CradleAction: Stack}
> work-proj> configure (lib)
> Configuring work-proj-9003...
> work-proj> initial-build-steps (lib)
> Configuring GHCi with the following packages: work-proj
> /home/cody/work-proj/.stack-work/install/x86_64-linux-nix/bf73507d5ab7d23ffbc635ca9a779c93abe2b07d289a0605721872c193f83a77/8.10.4/pkgdb:/home/cody/.stack/snapshots/x86_64-linux-nix/bf73507d5ab7d23ffbc635ca9a779c93abe2b07d289a0605721872c193f83a77/8.10.4/pkgdb:/nix/store/26zbw2cg6w0ih8gr5ab8vh670mccrd3v-ghc-8.10.4/lib/ghc-8.10.4/package.conf.d
haskell-language-server-8.10.4: Prelude.head: empty list

What is /home/cody/work-proj/a? ls shows me file not found. Is that something synthetic hls adds?

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: hie-biosstatus: needs infoNot actionable, because there's missing informationtype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions