Poison of dependencies from parent cabal.project
HLS tries to resolve dependencies from cabal.project file form parent folder, nonetheless child sub package don't have any reference these deps nor siblings.
Configuration is affected by cabal.project at '/home/don/pro/haskell/copilot'.
git clone https://github.com/Copilot-Language/copilot.git
cd copilot/copilot-core
cat<<EOF > hie.yaml
cradle:
multi:
- path: "./src"
config:
cradle:
cabal:
- path: "./tests"
config:
cradle:
cabal:
EOF
haskell-language-server --debug
2025-11-11T11:44:25.815271Z | Info | haskell-language-server version: 2.11.0.0 (GHC: 9.12.2) (PATH: /nix/store/aa9bya2glnbp40i96niclgp7jpa2hqy3-haskell-language-server-2.11.0.0/bin/.haskell-language-server-9.12.2-unwrapped) 2025-11-11T11:44:25.816463Z | Info | Directory: /home/don/pro/haskell/copilot/copilot-core 2025-11-11T11:44:25.816840Z | Info | Logging heap statistics every 60.00s ghcide setup tester in /home/don/pro/haskell/copilot/copilot-core. Report bugs at https://github.com/haskell/haskell-language-server/issues
Step 1/4: Finding files to test in /home/don/pro/haskell/copilot/copilot-core Found 11 files
Step 2/4: Looking for hie.yaml files that control setup Found 1 cradle (/home/don/pro/haskell/copilot/copilot-core/hie.yaml)
Step 3/4: Initializing the IDE 2025-11-11T11:44:25.905913Z | Debug | Initializing exports map from hiedb 2025-11-11T11:44:25.906511Z | Debug | Shake session initialized
Ste2025-11-11T11:44:25.906724Z | Debug | Done initializing exports map from hiedb. Size: 0 p 4/4: Type checking the files 2025-11-11T11:44:25.909140Z | Info | Cradle path: src/Copilot/Core/Spec.hs 2025-11-11T11:44:25.909786Z | Debug | Cradle: Cradle{ cradleRootDir = "/home/don/pro/haskell/copilot/copilot-core", cradleOptsProg = CradleAction: Cabal} 2025-11-11T11:44:25.909868Z | Info | invoking build tool to determine build flags (this may take some time depending on the cache) 2025-11-11T11:44:25.909949Z | Debug | Requested to load Cabal cradle using single file mode 2025-11-11T11:44:25.919340Z | Debug | cabal --numeric-version 2025-11-11T11:44:26.004113Z | Debug | cabal path --output-format=json 2025-11-11T11:44:26.051777Z | Debug | /nix/store/kpjx1qkw8sgzb9787xx5bx4zvhl4vp36-ghc-9.12.2-with-packages/bin/ghc --numeric-version 2025-11-11T11:44:26.052005Z | Info | Load cabal cradle using single file 2025-11-11T11:44:26.052113Z | Debug | Cabal Loading file /home/don/pro/haskell/copilot/copilot-core/src/Copilot/Core/Spec.hs from project: [ /home/don/pro/haskell/copilot/copilot-core/tests , /home/don/pro/haskell/copilot/copilot-core/src ] with prefixes: with actual loading files: [ /home/don/pro/haskell/copilot/copilot-core/src/Copilot/Core/Spec.hs ] 2025-11-11T11:44:26.055126Z | Info | cabal v2-repl --keep-temp-files --with-repl /home/don/.cache/hie-bios/repl-wrapper-fae20739a232ed1b9dcdf40eca9cf71e /home/don/pro/haskell/copilot/copilot-core/src/Copilot/Core/Spec.hs Environment Variables HIE_BIOS_OUTPUT: /tmp/nix-shell-3234045-401997632/HIE_BIOS_OUTPUT3234156-0 2025-11-11T11:44:26.085871Z | Debug | Configuration is affected by cabal.project at '/home/don/pro/haskell/copilot'. 2025-11-11T11:44:26.383983Z | Debug | Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal 2025-11-11T11:44:26.384146Z | Debug | update' to download it. 2025-11-11T11:44:26.421263Z | Debug | Resolving dependencies... 2025-11-11T11:44:26.422644Z | Debug | Error: [Cabal-7107] 2025-11-11T11:44:26.422758Z | Debug | Could not resolve dependencies: 2025-11-11T11:44:26.422877Z | Debug | [__0] trying: copilot-bluespec-4.6 (user goal)
Thank you for the bug report, it looks like the cli tool switches the working directory to the root of the cradle (which is where the cabal.project file is located).
It breaks even worse when trying to load a specific file:
$ haskell-language-server-wrapper --debug ./src/Copilot/Core.hs
No 'hie.yaml' found. Try to discover the project type!
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 2.11.0.0 x86_64 ghc-9.6.7
Current directory: /tmp/copilot/copilot-core
Operating system: linux
Arguments: ["--debug","./src/Copilot/Core.hs"]
Cradle directory: /tmp/copilot
Cradle type: Cabal
Tool versions found on the $PATH
cabal: 3.14.2.0
stack: 3.6.0
ghc: 9.10.3
Consulting the cradle to get project GHC version...
2025-11-11T12:48:27.838406Z | Debug | cabal --numeric-version
2025-11-11T12:48:27.853195Z | Debug | cabal path --output-format=json
2025-11-11T12:48:27.877330Z | Debug | /home/hugin/.ghcup/bin/ghc --numeric-version
Project GHC version: 9.10.3
haskell-language-server exe candidates: ["haskell-language-server-9.10.3","haskell-language-server"]
Launching haskell-language-server exe at:/home/hugin/.ghcup/bin/haskell-language-server-9.10.3
2025-11-11T12:48:27.892005Z | Debug | cabal path --output-format=json
2025-11-11T12:48:27.972745Z | Debug | /home/hugin/.ghcup/bin/ghc -v0 -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2025-11-11T12:48:27.988158Z | Debug | cabal path --output-format=json
2025-11-11T12:48:28.012768Z | Debug | /home/hugin/.ghcup/bin/ghc --print-libdir
2025-11-11T12:48:28.306145Z | Info | haskell-language-server version: 2.12.0.0 (GHC: 9.10.3) (PATH: /home/hugin/.ghcup/bin/haskell-language-server-9.10.3~2.12.0.0)
2025-11-11T12:48:28.306977Z | Info | Directory: /tmp/copilot
2025-11-11T12:48:28.307220Z | Info | Logging heap statistics every 60.00s
ghcide setup tester in /tmp/copilot.
Report bugs at https://github.com/haskell/haskell-language-server/issues
Step 1/4: Finding files to test in /tmp/copilot
haskell-language-server-9.10.3: ./src/Copilot/Core.hs: getDirectoryContents:openDirStream: does not exist (No such file or directory)
HasCallStack backtrace:
collectBacktraces, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:169: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/exceptions/src/Control/Monad/Catch.hs:308:12 in exceptions-0.10.9-e10f:Control.Monad.Catch
throwM, called at libraries/exceptions/src/Control/Monad/Catch.hs:318:7 in exceptions-0.10.9-e10f:Control.Monad.Catch
generalBracket, called at src/OpenTelemetry/Eventlog.hs:174:9 in opentelemetry-0.8.0-8a3c43177ea2c06706eb6abff7e19ea51cdab35f712fc33880c4fdee4c0ba0a8:OpenTelemetry.Eventlog
Do I read this correctly as solely being a bug on the cli or is it also broken in the editor?
Do I read this correctly as solely being a bug on the cli or is it also broken in the editor?
I was not looking bugs on purpose. I tried to open file in Emacs with lsp. Emacs lsp error buffer tells than hie.yaml is not found and current directory is parent.
Then I did a bit debugging - and noticed that output from just HLS in console tells that it also reads parent cabal file containing missing dependencies. Subpackage deps are configured with cabal2nix (it cannot handle multipackage)
I was not looking bugs on purpose.
No worries, even if you had been looking for bugs, we would have been greatful to you opening the issue!
Ok, so this needs some more fixes than just in the cli.
Then I did a bit debugging - and noticed that output from just HLS in console tells that it also reads parent cabal file containing missing dependencies. Subpackage deps are configured with cabal2nix (it cannot handle multipackage)
That's a problem I think, perhaps you will need to remove the cabal.project file so that HLS doesn't accidentally pick it up?