rust-lang/rust · critical · Exception

{} not found

Error message

{} not found

What it means

Raised by check_vendored_status() in bootstrap.py at line 1286 when use_vendored_sources is true but the vendor/ directory does not exist under rust_root. Vendored builds require all crate dependencies to be pre-downloaded into vendor/ (produced by 'x.py vendor'). The preceding eprint lines explain how to obtain vendored sources, including downloading a pre-vendored rustc-nightly-src tarball. The {} placeholder is the vendor_dir path.

Source

Thrown at src/bootstrap/bootstrap.py:1286

                    "       Alternatively, use the pre-vendored `rustc-src` dist component."
                )
                eprint(
                    "       To get a stable/beta/nightly version, download it from: "
                )
                eprint(
                    "       "
                    "https://forge.rust-lang.org/infra/other-installation-methods.html#source-code"
                )
                eprint(
                    "       To get a specific commit version, download it using the below URL,"
                )
                eprint("       replacing <commit> with a specific commit checksum: ")
                eprint("       ", url)
                eprint(
                    "       Once you have the source downloaded, place the vendor directory"
                )
                eprint("       from the archive in the root of the rust project.")
                raise Exception("{} not found".format(vendor_dir))

            if not os.path.exists(cargo_dir):
                eprint("ERROR: vendoring required, but .cargo/config does not exist.")
                raise Exception("{} not found".format(cargo_dir))


def parse_args(args):
    """Parse the command line arguments that the python script needs."""

    # Pass allow_abbrev=False to remove support for inexact matches (e.g.,
    # `--json` turning on `--json-output`). The argument list here is partial,
    # most flags are matched in the Rust bootstrap code. This prevents the
    # default ambiguity checks in argparse from functioning correctly.
    parser = argparse.ArgumentParser(add_help=False, allow_abbrev=False)
    parser.add_argument("-h", "--help", action="store_true")
    parser.add_argument("--config")
    parser.add_argument("--build-dir")
    parser.add_argument("--build")

View on GitHub (pinned to 7088e4b63a)

Solutions

  1. Run 'x.py vendor' on a machine with network access to populate the vendor/ directory, then copy it to the build machine.
  2. Download the pre-vendored rustc-nightly-src.tar.xz from https://ci-artifacts.rust-lang.org/rustc-builds/<commit>/ and extract its vendor/ directory into rust_root/vendor.
  3. If vendoring was auto-enabled because you ran as root (SUDO_USER detected), run the build as a non-root user instead.
  4. Disable vendored sources in config.toml (remove 'vendor = true') if network access is available.
Defensive patterns

Strategy: validation

Validate before calling

# Before building with vendored sources, verify vendor/ exists
import os
def check_vendor_dir(rust_root):
    vendor_dir = os.path.join(rust_root, 'vendor')
    if not os.path.exists(vendor_dir):
        print(f'ERROR: {vendor_dir} not found. Run: x.py vendor')
        return False
    return True

Try / catch

try:
    build.check_vendored_status()
except Exception as e:
    if 'not found' in str(e) and 'vendor' in str(e):
        print('Vendor directory missing. Run: x.py vendor')
        print('Or download pre-vendored sources from ci-artifacts.rust-lang.org')
    raise

Prevention

When it happens

Trigger: check_vendored_status() at line 1260-1262: self.use_vendored_sources is True (set by --vendored-sources flag, config.toml, or auto-enabled when running as root via SUDO_USER), and os.path.exists(vendor_dir) at line 1262 returns False where vendor_dir = rust_root/vendor.

Common situations: Building Rust in an air-gapped/offline environment with --vendor without first running 'x.py vendor'; running x.py as root (which auto-enables vendoring per line 1250-1255) without the vendor directory present; downloading a source tarball that didn't include vendor/; or accidentally deleting the vendor/ directory.

Related errors


AI-assisted analysis of rust-lang/rust@7088e4b63a (2026-08-10). Data as JSON: /api/errors/ac92e80edcf6ee63. Report an issue: GitHub.