Skip to content

clangd 23 module builder: one failed module (hello.test) blanks ALL completions — "Failed to compile src/test.cppm" while the project toolchain builds it fine #47

Open

Description

@Sunrisepeak

Environment

  • mcppls 0.0.11 payload (bundled clangd 23.1.0, kit mcppls-kit-libcxx-23.1.0-x86_64-unknown-linux-gnu), installed via xim
  • Project built by mcpp 2026.10.5.2 with toolchain clang 22.1.8 / libc++ 22.1.8 (mcpp build passes)
  • Linux x86_64, editor Neovim 0.12.5 via the mcppls-nvim plugin (plain LSP client, no other completion plugins)

Project shape

src/
  main.cpp        import std; import hello.greet; import hello.test; import hello.hhh; import hello.test.ccc;
  greet.cppm      export module hello.greet; …
  test.cppm       export module hello.test; import std; export namespace hello { auto test() { std::println("hello"); } }
  hhh.cppm / xxxx.cppm / test/ccc.cppm …
mcpp.toml, compile_commands.json (mcpp-written)

What happens

clangd's module builder fails on hello.test and, from that point on, every textDocument/completion is answered with 0 items instantly — std::, std::ve, hello::, all of them. The response arrives in ~1 ms with no error (err == nil), status keeps reporting ready, and no diagnostic is shown to the user, so it just looks like "completion is dead".

Server log (mcppls 0.0.11, serve pipeline):

[warning] clangd (…/test/mcpp/hello): E[…] Failed to build module hello.test; due to Failed to compile …/src/test.cppm. Use '--log=verbose' to view detailed failure reasons. …
[warning] 2 files routed to mcppls's own engine (…): 1 module cannot be prepared because hello.test failed: Failed to compile …/src/test.cppm
[warning] clangd could not build module hello.test (…): Failed to compile …/src/test.cppm
[warning] clangd (…) has kept a core busy for 30 s on main.cpp, which it is not building; restarting it
[warning] clangd (…): E[…] Transport error: Input/output error

Key data points

  1. The project toolchain compiles it fine. mcpp build (clang 22.1.8) passes; the failure is specific to clangd 23.1's own module-hints builder (build database flags come from the clang 22.1.8 cdb, with -resource-dir pointed at clangd 23 and -fmodule-file hints into the workspace module-hints/).
  2. mcppls check src/test.cppm passes (clangd exit 0) — the failure only shows up in the serve-time hints pipeline, which makes it invisible to the check tooling.
  3. Counter-experiment isolates it. A copy of the same project with import hello.test; dropped (and test.cppm removed), everything else identical: std::ve → std::vector, hello:: → greet, completions fully alive.
  4. The failure cascades through the hints chain: with hello.test unbuildable, dependent -fmodule-file=hello.test=…pcm/std.pcm hints reference pcms that never get produced (module file not found when the prime files are compiled manually), so even import std completions die — well beyond the one broken module.

Asks

  1. Graceful degradation: when one module fails to build, exclude it from the hint set and keep serving completions for the rest of the project (today one bad module blanks std:: and every other scope, which reads as "LSP is broken" to the user, with nothing on screen).
  2. Root-cause the clangd 23.1 compile failure of this module — at default log level the underlying clang error is not surfaced (--log=verbose hint comes from clangd itself). I can run the session with --log=verbose / --debug-modules-builder and attach the diagnostic bundle — tell me which you prefer.

Happy to provide the full project (it is ~6 small files) if useful.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions