[Begginer]error: could not load Cargo configuration

I am studying CARGO config at the following site

cargo-book

If the following settings are made as described, an error: could not load Cargo configuration will occur.
If anyone knows of a solution, please let me know.

Config

[http]
debug = false               # HTTP debugging
proxy = "host:port"         # HTTP proxy in libcurl format
ssl-version = "tlsv1.3"     # TLS version to use
ssl-version.max = "tlsv1.3" # maximum TLS version
ssl-version.min = "tlsv1.1" # minimum TLS version

Output

error: could not load Cargo configuration

Caused by:
  could not parse TOML configuration in `C:\Users\user\projects\cargo-book\3-ref\config\.cargo\config`

Caused by:
  could not parse input as TOML

Caused by:
  TOML parse error at line 30, column 1
     |
  30 | ssl-version.max = "tlsv1.3" # maximum TLS version
     | ^
  Dotted key `ssl-version` attempted to extend non-table type (string)

Delete the following two lines and the build will succeed

ssl-version.max = "tlsv1.3" # maximum TLS version
ssl-version.min = "tlsv1.1" # minimum TLS version

Version

cargo -Vv
cargo 1.67.1 (8ecd4f20a 2023-01-10)
release: 1.67.1
commit-hash: 8ecd4f20a9efb626975ac18a016d480dc7183d9b
commit-date: 2023-01-10
host: x86_64-pc-windows-msvc
libgit2: 1.5.0 (sys:0.16.0 vendored)
libcurl: 7.86.0-DEV (sys:0.4.59+curl-7.86.0 vendored ssl:Schannel)
os: Windows 10.0.19045 (Windows 10 Pro) [64-bit]

The syntax in the book is invalid, as it shows mutually-exclusive options all together.

You can have either:

[http]
ssl-version = "tlsv1.3"
# AND NOTHING ELSE ABOUT SSL-VERSION

or

[http]
ssl-version.max = "tlsv1.3"
ssl-version.min = "tlsv1.1" 
# ssl-version setting is now FORBIDDEN

This is because the min/max syntax means:

ssl-version = { min = "tlsv1.1", max = "tlsv1.3" }

and the same setting can't be both a string and an object at the same time.

2 Likes

Thank you.
You have helped me solve the problem.

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.