rtk-ai/rtk · error
consent requires interactive terminal — cannot enable…
Error message
consent requires interactive terminal — cannot enable telemetry in piped mode
What it means
Enabling RTK telemetry requires explicit, informed consent typed by a human. `run_enable` therefore refuses to run when stdin is not a TTY (`io::stdin().is_terminal()` is false), because a piped or scripted invocation cannot provide genuine interactive consent for anonymous usage-data collection.
Solutions
- Run the enable command in a real interactive terminal (no pipes/redirects on stdin).
- Enable telemetry by setting the relevant config/env value directly (e.g. the telemetry opt-in key in rtk's config file or env var) instead of going through the interactive consent flow.
- If automation is required, skip telemetry entirely or use a config-management step that writes the consent flag yourself, acknowledging the consent policy.
Example fix
// before (script) echo "y" | rtk telemetry enable // after # run interactively once: rtk telemetry enable # or set config directly: rtk config set telemetry.enabled true
Defensive patterns
Strategy: fallback
Validate before calling
use std::io::IsTerminal;
if !std::io::stdin().is_terminal() {
eprintln!("skipping `rtk telemetry enable`: requires interactive terminal");
return Ok(());
} Try / catch
match rtk_telemetry_enable().err() {
Some(e) if e.to_string().contains("interactive terminal") => {
eprintln!("telemetry enable must be run interactively; skipping");
}
_ => {}
} Prevention
- Only invoke consent-requiring commands from interactive shells.
- In install scripts, guard the call with a TTY check or skip telemetry setup entirely.
- Prefer writing the telemetry config flag directly in automation rather than scripting the interactive prompt.
When it happens
Trigger: Running `rtk telemetry enable` (or whatever routes to run_enable) with stdin piped or redirected, e.g. `echo y | rtk telemetry enable`, inside CI scripts, non-interactive shells, docker exec without -t, or from another program spawning rtk without a TTY.
Common situations: Automating RTK setup in dotfiles or CI where a user tries to pre-answer the consent prompt; running inside containers or IDE terminals without a TTY; wrapping rtk commands in scripts that pipe stdin.
Related errors
- no telemetry endpoint configured
- ambiguous hash prefix
- Antigravity is project-scoped. Use: rtk init --agent…
- at least one of install_claude or install_opencode must be…
- bunx requires a command argument
AI-assisted analysis of rtk-ai/rtk@0924356b4c (2026-09-19).
Data as JSON: /api/errors/30d57c45760fcc8e.
Report an issue: GitHub.
Appendix: source
Thrown at src/core/telemetry_cmd.rs:155
env_override,
config.telemetry.enabled,
config.telemetry.consent_given,
hash.as_deref(),
)
);
println!();
println!("Data controller: RTK AI Labs, contact@rtk-ai.app");
println!("Details: https://github.com/rtk-ai/rtk/blob/master/docs/TELEMETRY.md");
Ok(())
}
fn run_enable() -> Result<()> {
use std::io::{self, BufRead, IsTerminal};
if !io::stdin().is_terminal() {
anyhow::bail!(
"consent requires interactive terminal — cannot enable telemetry in piped mode"
);
}
eprintln!("RTK collects anonymous usage metrics once per day to improve filters.");
eprintln!();
eprintln!(" What: command names (not arguments), token savings, OS, version");
eprintln!(" Who: RTK AI Labs, contact@rtk-ai.app");
eprintln!(" Details: https://github.com/rtk-ai/rtk/blob/master/docs/TELEMETRY.md");
eprintln!();
eprint!("Enable anonymous telemetry? [y/N] ");
let stdin = io::stdin();
let mut line = String::new();
stdin
.lock()
.read_line(&mut line)
.context("Failed to read user input")?;View on GitHub (pinned to 0924356b4c)