Skip to content

rust-analyzer fails with "error: config value env is not set" #17739

@shanebishop

Description

@shanebishop

rust-analyzer version: 0.3.2053-standalone

rustc version: rustc 1.79.0 (129f3b996 2024-06-10)

editor or extension: VSCode

relevant settings: RUSTC_WRAPPER="$HOME/.cargo/bin/sccache"

repository link (if public, optional):

code snippet to reproduce: N/A

environment: WSL 2, Ubuntu 22.04 x86_64

Error

When I open my workspace in VSCode, rust-analyzer doesn't show any red underlines for syntactically incorrect code. When I look at the output of rust-analyzer in the OUTPUT tab, I see this:

2024-07-29T18:56:36.485666Z ERROR Failed to discover cargo config env: cd "/home/shane/src/redacted" && RUSTC_BOOTSTRAP="1" RUSTUP_TOOLCHAIN="/home/shane/.rustup/toolchains/stable-x86_64-unknown-linux-gnu" "/home/shane/.cargo/bin/cargo" "-Z" "unstable-options" "config" "get" "env" failed, exit status: 101
stderr:
error: config value env is not set

Stack backtrace:
0: anyhow::error::::msg
1: project_model::utf8_stdout
2: project_model::env::cargo_config_env
3: project_model::workspace::ProjectWorkspace::load
4: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
5: <alloc::vec::Vec as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
6: core::ops::function::FnOnce::call_once{{vtable.shim}}
7: std::sys_common::backtrace::__rust_begin_short_backtrace
8: core::ops::function::FnOnce::call_once{{vtable.shim}}
9: std::sys::pal::unix::thread::Thread::new::thread_start
10: <unknown>
11: <unknown>

In case it is relevant, here is the Cargo.toml in the root of my workspace:

[workspace]
resolver = "2"
members = [ "hydra", "li_engine", "lich"]
exclude = [ "c_library_bindings" ]

[profile.release]
opt-level = "z"
strip = true
lto = true
#codegen-units = 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions