Skip to content

The command produced no valid metadata #11336

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

Closed
Michael-F-Bryan opened this issue Jan 23, 2022 · 14 comments
Closed

The command produced no valid metadata #11336

Michael-F-Bryan opened this issue Jan 23, 2022 · 14 comments
Labels
C-support Category: support questions

Comments

@Michael-F-Bryan
Copy link
Contributor

When VS Code loads and rust-analyzer is loading my workspace, I am shown the following popup:

2022-01-24_02-02-00-23

This happens fairly consistently for me for the https://github.com/hotg-ai/proc-blocks project.

Here are some minimal instructions for checking out a version I'm seeing issues with (the latest master), although I've seen the same issue when checking out commits from a couple months ago.

$ cd /tmp
$ git clone [email protected]:hotg-ai/proc-blocks.git
$ cd proc-blocks 
$ git checkout 441e1e9be  # current master
$ cargo build --quiet
   Compiling proc-macro2 v1.0.36
   ...
   Compiling fft v0.11.1 (/home/consulting/Documents/hotg-ai/proc-blocks/fft)
    Finished dev [unoptimized + debuginfo] target(s) in 14.61s
$ code .
Rust Analyzer Client output
INFO [1/24/2022, 2:05:24 AM]: Extension version: 0.3.914
INFO [1/24/2022, 2:05:24 AM]: Using configuration {
  cargoRunner: null,
  runnableEnv: null,
  inlayHints: {
    enable: true,
    smallerHints: true,
    chainingHints: true,
    maxLength: 25,
    parameterHints: false,
    typeHints: true,
    hideNamedConstructorHints: false
  },
  server: { path: null, extraEnv: null },
  trace: { server: 'off', extension: true },
  debug: {
    engine: 'auto',
    sourceFileMap: {
      '/rustc/<id>': '${env:USERPROFILE}/.rustup/toolchains/<toolchain-id>/lib/rustlib/src/rust'
    },
    openDebugPane: false,
    engineSettings: {}
  },
  assist: {
    exprFillDefault: 'todo',
    importGranularity: 'crate',
    importEnforceGranularity: true,
    importPrefix: 'by_crate',
    importGroup: true,
    allowMergingIntoGlobImports: true
  },
  cache: { warmup: true },
  callInfo: { full: true },
  cargo: {
    autoreload: true,
    allFeatures: true,
    unsetTest: [ 'core' ],
    features: [],
    runBuildScripts: true,
    useRustcWrapperForBuildScripts: true,
    noDefaultFeatures: false,
    target: null,
    noSysroot: false,
    loadOutDirsFromCheck: true
  },
  checkOnSave: {
    enable: true,
    allFeatures: null,
    allTargets: true,
    command: 'check',
    noDefaultFeatures: null,
    target: null,
    extraArgs: [ '--target-dir', '/tmp/rust-analyzer-target' ],
    features: null,
    overrideCommand: null
  },
  completion: {
    addCallArgumentSnippets: true,
    addCallParenthesis: true,
    snippets: {
      'Arc::new': {
        postfix: 'arc',
        body: 'Arc::new(${receiver})',
        requires: 'std::sync::Arc',
        description: 'Put the expression into an `Arc`',
        scope: 'expr'
      },
      'Rc::new': {
        postfix: 'rc',
        body: 'Rc::new(${receiver})',
        requires: 'std::rc::Rc',
        description: 'Put the expression into an `Rc`',
        scope: 'expr'
      },
      'Box::pin': {
        postfix: 'pinbox',
        body: 'Box::pin(${receiver})',
        requires: 'std::boxed::Box',
        description: 'Put the expression into a pinned `Box`',
        scope: 'expr'
      },
      Ok: {
        postfix: 'ok',
        body: 'Ok(${receiver})',
        description: 'Wrap the expression in a `Result::Ok`',
        scope: 'expr'
      },
      Err: {
        postfix: 'err',
        body: 'Err(${receiver})',
        description: 'Wrap the expression in a `Result::Err`',
        scope: 'expr'
      },
      Some: {
        postfix: 'some',
        body: 'Some(${receiver})',
        description: 'Wrap the expression in an `Option::Some`',
        scope: 'expr'
      }
    },
    postfix: { enable: true },
    autoimport: { enable: true },
    autoself: { enable: true }
  },
  diagnostics: {
    enable: true,
    enableExperimental: true,
    disabled: [ 'macro-error' ],
    remapPrefix: {},
    warningsAsHint: [],
    warningsAsInfo: []
  },
  experimental: { procAttrMacros: true },
  files: { watcher: 'client', excludeDirs: [] },
  highlightRelated: {
    references: true,
    exitPoints: true,
    breakPoints: true,
    yieldPoints: true
  },
  highlighting: { strings: true },
  hover: { documentation: true, linksInHover: true },
  hoverActions: {
    debug: true,
    enable: true,
    gotoTypeDef: true,
    implementations: true,
    references: false,
    run: true
  },
  joinLines: {
    joinElseIf: true,
    removeTrailingComma: true,
    unwrapTrivialBlock: true,
    joinAssignments: true
  },
  lens: {
    debug: true,
    enable: true,
    implementations: true,
    run: true,
    methodReferences: false,
    references: false,
    enumVariantReferences: false,
    forceCustomCommands: true
  },
  linkedProjects: [],
  lruCapacity: null,
  notifications: { cargoTomlNotFound: false },
  procMacro: { enable: true, server: null, ignored: {} },
  runnables: { overrideCargo: null, cargoExtraArgs: [] },
  rustcSource: null,
  rustfmt: {
    extraArgs: [],
    overrideCommand: null,
    enableRangeFormatting: false
  },
  workspace: { symbol: { search: { scope: 'workspace', kind: 'only_types' } } },
  updates: { channel: 'nightly' }
}
INFO [1/24/2022, 2:05:24 AM]: PersistentState: { serverVersion: '0.3.914' }
INFO [1/24/2022, 2:05:24 AM]: Using server binary at /home/consulting/.vscode/extensions/matklad.rust-analyzer-0.3.914/server/rust-analyzer
DEBUG [1/24/2022, 2:05:24 AM]: Checking availability of a binary at /home/consulting/.vscode/extensions/matklad.rust-analyzer-0.3.914/server/rust-analyzer
DEBUG [1/24/2022, 2:05:24 AM]: /home/consulting/.vscode/extensions/matklad.rust-analyzer-0.3.914/server/rust-analyzer --version: {
  status: 0,
  signal: null,
  output: [ null, 'rust-analyzer baa5cd952 2022-01-23 nightly\n', '' ],
  pid: 4080009,
  stdout: 'rust-analyzer baa5cd952 2022-01-23 nightly\n',
  stderr: ''
}
Rust Analyzer Language Server output
[ERROR flycheck] Flycheck failed to run the following command: "cargo" "check" "--workspace" "--message-format=json" "--manifest-path" "/home/consulting/Documents/hotg-ai/proc-blocks/Cargo.toml" "--all-targets" "--all-features" "--target-dir" "/tmp/rust-analyzer-target"

I enabled the rust-analyzer.trace.extension setting and restarted VS Code, but the "Rust Analyzer Language Server Trace" output doesn't seem to contain anything.


rust-analyzer version: rust-analyzer version: baa5cd952 2022-01-23 nightly

rustc version:

$ rustc --version --verbose
rustc 1.58.0-nightly (bd41e09da 2021-10-18)
binary: rustc
commit-hash: bd41e09da334697c0f993b36685cb599061d9faa
commit-date: 2021-10-18
host: x86_64-unknown-linux-gnu
release: 1.58.0-nightly
LLVM version: 13.0.0
@lnicola
Copy link
Member

lnicola commented Jan 23, 2022

I wasn't able to reproduce in ten tries or so. It looks like cargo check is actually failing, but I don't know what that would happen.

@Michael-F-Bryan
Copy link
Contributor Author

It might be something specific to my setup, then. Do you have any suggestions for troubleshooting this or seeing what cargo check actually outputs?

@jonas-schievink
Copy link
Contributor

The status code 25856 might indicate that Cargo was killed by a signal

@TornaxO7
Copy link

I'm getting the same issue as well, if I try to run rust-analyzer on rust-osdev/bootloader with rust-analyzer.cargo.allFeatures = true.

@giluis
Copy link

giluis commented Mar 11, 2022

I am getting the same issue using using NeoVim's LSP client.
Is there any update on this?

@flodiebold flodiebold added the C-support Category: support questions label Mar 31, 2022
@flipbit03
Copy link
Contributor

Do you guys have clippy installed and updated? This seemed to fix things for me.

@latidoremi
Copy link

Same issue using vscode on mac
截屏2022-04-06 下午6 50 49

rustc --version --verbose
rustc 1.59.0 (9d1b2106e 2022-02-23)
binary: rustc
commit-hash: 9d1b2106e23b1abd32fce1f17267604a5102f57a
commit-date: 2022-02-23
host: x86_64-apple-darwin
release: 1.59.0
LLVM version: 13.0.0

This error will raise every time I save project files, any project I mean, even empty projects, it's so annoying that I have to quit using ra for now :(

I've tried reinstalling ra, updating clippy and nothing works

@Veykril
Copy link
Member

Veykril commented Apr 6, 2022

What rust-analyzer version are you using? Starting next week's stable release and today's nightly we should show the entire error message given #11891

@latidoremi
Copy link

What rust-analyzer version are you using? Starting next week's stable release and today's nightly we should show the entire error message given #11891

v0.2.1002
If I switch to pre-release version v0.3.1004, this is what the error looks like
截屏2022-04-06 下午6 59 27

@bjorn3
Copy link
Member

bjorn3 commented Apr 6, 2022

It looks like the rust-analyzer.checkOnSave.command preference is set to an empty string. Can you check if this is indeed the case and if so remove the preference?

@Veykril
Copy link
Member

Veykril commented Apr 6, 2022

We should probably warn against that (maybe have a general validation thing for the config somehow)

@latidoremi
Copy link

It looks like the rust-analyzer.checkOnSave.command preference is set to an empty string. Can you check if this is indeed the case and if so remove the preference?

Yes, removing the rust-analyzer.checkOnSave.command preference solves the problem, thanks!!!

@fitzchivalrik
Copy link

I had the same error for the longest time and could not figure out what I did wrong. Using the pre-release version, which adds the error output, I managed to track it down: I had a faulty rust-analyzer.checkOnSave.extraArgs setting, I was missing '--' as the first argument:
Wrong: "rust-analyzer.checkOnSave.extraArgs": ["-W", "clippy::pedantic"]
Correct: "rust-analyzer.checkOnSave.extraArgs": ["--","-W", "clippy::pedantic"]

@Veykril
Copy link
Member

Veykril commented Apr 9, 2022

I think we can close this now, as the error should now be able to tell what went wrong.

@Veykril Veykril closed this as completed Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-support Category: support questions
Projects
None yet
Development

No branches or pull requests