rust-lang/rust · error · Exception

Unrecognized config profile '{}'. Check src/bootstrap/defaul

Error message

Unrecognized config profile '{}'. Check src/bootstrap/defaults for available options.

What it means

Raised in bootstrap.py at line 1386 when a config profile name passed via --profile (or the default) does not correspond to an existing file in src/bootstrap/defaults/. The profile is resolved to a filename 'bootstrap.<profile>.toml' (after applying profile_aliases, e.g. 'user' -> 'dist'), and if that file doesn't exist at src/bootstrap/defaults/bootstrap.<profile>.toml, the profile is unrecognized.

Source

Thrown at src/bootstrap/bootstrap.py:1386

    profile = RustBuild.get_toml_static(config_toml, "profile")
    is_non_git_source = not os.path.exists(os.path.join(rust_root, ".git"))

    if profile is None and is_non_git_source:
        profile = "dist"

    if profile is not None:
        # Allows creating alias for profile names, allowing
        # profiles to be renamed while maintaining back compatibility
        # Keep in sync with `profile_aliases` in config.rs
        profile_aliases = {"user": "dist"}
        include_file = "bootstrap.{}.toml".format(
            profile_aliases.get(profile) or profile
        )
        include_dir = os.path.join(rust_root, "src", "bootstrap", "defaults")
        include_path = os.path.join(include_dir, include_file)

        if not os.path.exists(include_path):
            raise Exception(
                "Unrecognized config profile '{}'. Check src/bootstrap/defaults"
                " for available options.".format(profile)
            )

        # HACK: This works because `self.get_toml()` returns the first match it finds for a
        # specific key, so appending our defaults at the end allows the user to override them
        with open(include_path, encoding="utf-8") as included_toml:
            config_toml += os.linesep + included_toml.read()

    # Configure initial bootstrap
    build = RustBuild(config_toml, args)
    build.check_vendored_status()

    if not os.path.exists(build.build_dir):
        os.makedirs(os.path.realpath(build.build_dir))

    # Fetch/build the bootstrap
    build.download_toolchain()

View on GitHub (pinned to 7088e4b63a)

Solutions

  1. List available profiles: 'ls src/bootstrap/defaults/' to see valid bootstrap.<name>.toml files.
  2. Check for typos in the --profile argument.
  3. Review profile_aliases at line 1378 (currently {'user': 'dist'}) to see if an alias applies.
  4. Create a custom profile file at src/bootstrap/defaults/bootstrap.<your-profile>.toml if you need a new one.

Example fix

# before
./x.py build --profile developper
# after (use the correct name)
./x.py build --profile developer
Defensive patterns

Strategy: validation

Validate before calling

# Before building, validate the profile name against available files
import os
def validate_profile(rust_root, profile):
    profile_aliases = {'user': 'dist'}
    resolved = profile_aliases.get(profile) or profile
    include_path = os.path.join(
        rust_root, 'src', 'bootstrap', 'defaults', f'bootstrap.{resolved}.toml'
    )
    if not os.path.exists(include_path):
        available = os.listdir(os.path.join(rust_root, 'src', 'bootstrap', 'defaults'))
        print(f'Invalid profile: {profile}. Available: {available}')
        return False
    return True

Try / catch

try:
    # ... bootstrap startup code
except Exception as e:
    if 'Unrecognized config profile' in str(e):
        import os
        defaults_dir = os.path.join('src', 'bootstrap', 'defaults')
        print('Available profiles:', os.listdir(defaults_dir))
    raise

Prevention

When it happens

Trigger: At bootstrap.py:1374-1389: profile is not None (set by --profile flag or auto-set to 'dist' for non-git source builds at line 1372). include_path is computed as src/bootstrap/defaults/bootstrap.<profile>.toml (line 1383). os.path.exists(include_path) at line 1385 returns False.

Common situations: Typo in the --profile argument (e.g. '--profile developper' instead of '--profile developer'); using a profile name from a newer/older Rust version that doesn't exist in the current checkout; a custom profile that was never created in src/bootstrap/defaults/; or passing 'user' on a version where the alias to 'dist' isn't configured.

Related errors


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