Compile error when adding 'authors` to Cargo.toml

Whenever I try to build my simple "Hello World"ish project using the authors attribute in the [package] section of my Cargo.toml file, I receive the cryptic error listed below. I note from the cargo book that package manifests cannot be changed in public-published versions of a package; however, I have not published this package.

Thank you for your help in advance

Execution failed (exit code 101).
/Users/ptdecker/.cargo/bin/cargo metadata --verbose --format-version 1 --all-features
stdout : error: failed to parse manifest at `/Users/ptdecker/CLionProjects/alenandbarb/Cargo.toml`

Caused by:
  data did not match any variant of untagged enum MaybeWorkspace for key `package.authors`

stderr : 

My cargo.toml:

[package]
name = "alenandbarb"
version = "0.1.0"
edition = "2021"
authors = "Todd Decker"
description = "A toy application for crustatian exploration along network and applications seafloor"

[features]
desktop = ["dioxus/desktop"]
web = ["dioxus/web"]

[dependencies]
dioxus = { version = "0.2.4" }

It should be an array of strings, not just a single string.

1 Like

Well... that was dumb of me. Thank you, @Hyeonu . I guess I should have picked that up given "authors" is plural and The Cargo Book specifies "a list". Thank you.

It may also be worth mentioning: the authors field is no longer required, and it's not displayed anywhere on crates.io/docs.rs any more [1]. So you don't need to add this unless you really want to :slight_smile:


  1. They use the crate owner list from crates.io instead, which can be changed after publish and isn't tied to one specific version of the crate. â†Šī¸Ž

3 Likes

Mind creating an issue about how bad that error message is?

I've submitted a PR to clarify the documentation which doesn't address the error message directly. I don't know enough yet about Rust to really make that call, but that error message does seem a bit obtuse. It confused me although my error is, with 20/20 hindsight, obvious I guess.

@epage I have also submitted an issue per your suggestion:

https://github.com/rust-lang/cargo/issues/10942

Thank you!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.