xai-org/grok-build · warning

local workspace cancelled

Error message

local workspace cancelled

What it means

This error is raised during the interactive local-workspace consent gate in `emit_local_workspace_startup_ux_with`. When the user is prompted to acknowledge the risks of enabling the local workspace (a y/Y/yes/YES confirmation read from stdin), any other input is treated as a refusal, and the startup flow aborts with this bail. It is an intentional cancellation path, not an unexpected failure — the library requires explicit opt-in to the `local-workspace` feature before continuing startup.

Source

Thrown at crates/codegen/xai-grok-pager/src/app/session_startup.rs:563

        .map(|p| p.display().to_string())
        .unwrap_or_else(|| "<session cwd>".to_string());
    let banner = LOCAL_WORKSPACE_BANNER.replace("<cwd>", &cwd_display);
    eprintln!("{banner}");
    eprintln!("{LOCAL_WORKSPACE_HITL_HINT}");
    if local_workspace_ack_satisfied() {
        return Ok(());
    }
    if !stdin_is_terminal {
        anyhow::bail!("{LOCAL_WORKSPACE_ACK_REQUIRED}");
    }
    eprint!("Continue with local workspace on this machine? [y/N] ");
    use std::io::Write;
    let _ = std::io::stderr().flush();
    let mut line = String::new();
    std::io::stdin().read_line(&mut line)?;
    let ok = matches!(line.trim(), "y" | "Y" | "yes" | "YES");
    if !ok {
        anyhow::bail!("local workspace cancelled");
    }
    write_local_workspace_ack();
    Ok(())
}
/// True when ACK env or ack file already authorizes local workspace.
#[cfg(feature = "local-workspace")]
pub fn local_workspace_ack_satisfied() -> bool {
    if env_truthy(GROK_CHAT_LOCAL_WORKSPACE_ACK_ENV) {
        return true;
    }
    local_workspace_ack_path().is_some_and(|p| p.is_file())
}
/// Persist the first-run local-workspace ACK file (best-effort).
#[cfg(feature = "local-workspace")]
pub fn write_local_workspace_ack() {
    if let Some(path) = local_workspace_ack_path() {
        if let Some(parent) = path.parent() {
            let _ = std::fs::create_dir_all(parent);

View on GitHub (pinned to bc7f02eddd)

Solutions

  1. Re-run the command and answer the local-workspace confirmation prompt with exactly 'y', 'Y', 'yes', or 'YES'.
  2. Pre-authorize the session so the prompt is skipped: set the ACK environment variable or create the ack file that `write_local_workspace_ack()`/the `ack env or ack file` check accepts.
  3. If running non-interactively (CI/scripts), feed 'y' as the first stdin line, e.g. `echo y | xai-grok ...`, or pre-create the ack file.
  4. If you did not intend to enable the local workspace, pass flags/options that avoid the local-workspace path entirely instead of declining the prompt.

Example fix

// before: script hangs/aborts because stdin is empty
xai-grok --local-workspace < /dev/null
// after: pre-authorize or answer the prompt
echo y | xai-grok --local-workspace
# or, better, pre-create the ack file once:
# write_local_workspace_ack() equivalent, or set the ACK env var
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check: ensure an explicit ack exists so the interactive prompt is skipped.
use std::path::Path;
fn local_workspace_ack_present(ack_file: &str, ack_env: Option<&str>) -> bool {
    std::env::var_os(ack_env.unwrap_or("XAI_GROK_LOCAL_WS_ACK")).is_some()
        || Path::new(ack_file).exists()
}
// If false and stdin is not a TTY, pass `y` on stdin or pre-create the ack file.

Type guard

fn is_affirmative(input: &str) -> bool {
    matches!(input.trim(), "y" | "Y" | "yes" | "YES")
}

Try / catch

match run_startup() {
    Err(e) if e.to_string().contains("local workspace cancelled") => {
        eprintln!("Startup aborted: local workspace requires explicit y/N acknowledgment.");
        std::process::exit(2);
    }
    Err(e) => return Err(e),
    Ok(v) => v,
}

Prevention

When it happens

Trigger: Running the CLI in a non-TTY context where `local_workspace_non_tty_requires_ack` prompts via stdin and the user (or an automated pipe/script) sends anything other than 'y', 'Y', 'yes', or 'YES' as the first line of stdin; also pressing Enter or typing 'no'/'n' at the local-workspace acknowledgment prompt.

Common situations: Piping commands or heredocs into the CLI whose first line is not the confirmation string; running under CI or a process manager where stdin is empty or closed so read_line returns an empty line; a human typing 'ok', 'y ' with trailing chars is trimmed fine but 'no' aborts; forgetting that local workspace requires the explicit ack (env var or ack file).

Related errors


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