xai-org/grok-build · error

Profile '{name}' extends invalid base: {e}

Error message

Profile '{name}' extends invalid base: {e}

What it means

Profile resolution parses the `extends` field of a profile config into a `ProfileName` via its FromStr impl; when the base name is not a recognized profile name, resolve in crates/codegen/xai-grok-sandbox/src/profiles.rs:481 wraps the parse error with this message. It exists to tell you WHICH profile's `extends` entry is bad, not just that parsing failed. Note a separate check also rejects 'off'/'none' as a base even if it parses.

Source

Thrown at crates/codegen/xai-grok-sandbox/src/profiles.rs:481

                    restrict_network: true,
                })
            }

            Self::Custom(name) => {
                let profile_config = config.profiles.get(name).ok_or_else(|| {
                    anyhow::anyhow!(
                        "Custom sandbox profile '{name}' not found. \
                         Define it in ~/.grok/sandbox.toml or .grok/sandbox.toml:\n\n\
                         [profiles.{name}]\n\
                         extends = \"workspace\"\n\
                         read_only = [\"/data\"]\n"
                    )
                })?;

                // Start from the base profile if `extends` is set
                let (base, mut profile) = if let Some(base_name) = &profile_config.extends {
                    let base: ProfileName = base_name.parse().map_err(|e: String| {
                        anyhow::anyhow!("Profile '{name}' extends invalid base: {e}")
                    })?;
                    if matches!(base, Self::Off) {
                        anyhow::bail!(
                            "Profile '{name}' extends '{base_name}', but 'off'/'none' \
                             is not a valid base profile"
                        );
                    }
                    if matches!(base, Self::Custom(_)) {
                        anyhow::bail!(
                            "Profile '{name}' extends '{base_name}', but custom profiles \
                             cannot extend other custom profiles (only built-ins)"
                        );
                    }
                    let resolved = base.resolve(workspace, config)?;
                    (base, resolved)
                } else {
                    (Self::Workspace, Self::Workspace.resolve(workspace, config)?)
                };

View on GitHub (pinned to bc7f02eddd)

Solutions

  1. Open the profile config and correct `extends` to an exact valid profile name (match the ProfileName FromStr spelling, e.g. as defined in profiles.rs).
  2. Check the inner error `{e}` — it lists/indicates the accepted names.
  3. If a profile was renamed in a newer version, update the `extends` reference to the new name.
  4. Do not use 'off'/'none' as a base; it is explicitly rejected even if it parses.

Example fix

// before (profile config)
extends = "Balnced"
// after
extends = "balanced"
Defensive patterns

Strategy: validation

Validate before calling

const VALID: &[&str] = &["off", "balanced", /* ...accepted names... */];
fn ensure_valid_base(extends: &str) -> Result<(), String> {
    if VALID.contains(&extends) { Ok(()) } else { Err(format!("unknown base profile: {extends}")) }
}

Prevention

When it happens

Trigger: Calling resolve or resolve_profile_with_runtime_sockets on a profile whose config has `extends: "<string>"` that fails ProfileName::from_str — e.g. a typo like "saftey", wrong casing like "Balanced", or an unknown custom name.

Common situations: Hand-edited profile TOML/JSON configs; renamed or removed built-in profiles after a version upgrade leaving stale `extends` references; copy-pasting profile definitions between repos with different profile sets.

Related errors


AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31). Data as JSON: /api/errors/c2a56f776db0df7f. Report an issue: GitHub.