Skip to content

Confusing error message with --manifest-path to a non-existing path #16612

@ehuss

Description

@ehuss

Problem

When running cargo run --manifest-path foo.rs, cargo prints the following:

error: the manifest-path must be a path to a Cargo.toml file: `/Users/eric/Temp/z10/foo.rs`

This is a little confusing because --manifest-path can point to either a Cargo.toml or an embedded script file.

Steps

cargo run --manifest-path foo.rs

Possible Solution(s)

The error could say something like:

error: the manifest-path must be a path to a Cargo.toml file or a script file: `{path}`

Notes

No response

Version

cargo 1.95.0-nightly (fe2f314ae 2026-01-30)
release: 1.95.0-nightly
commit-hash: fe2f314aef06e688a9517da1ac0577bb1854d01f
commit-date: 2026-01-30
host: aarch64-apple-darwin
libgit2: 1.9.2 (sys:0.20.3 vendored)
libcurl: 8.7.1 (sys:0.4.83+curl-8.15.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 3.5.4 30 Sep 2025
os: Mac OS 26.2.0 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Error and warning messages generated by Cargo itself.C-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.Z-scriptNightly: cargo script

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions