Hmbown/CodeWhale · error · anyhow::Error
refusing terminal output; pipe credential handoff to the int
Error message
refusing terminal output; pipe credential handoff to the intended local client
What it means
Guard in prepare_stdout: the credential handoff command refuses to write the secret line when stdout is a terminal. The handoff is designed to be piped to a local client; printing a raw credential to an interactive terminal would expose it to screen, scrollback, and accidental copy.
Source
Thrown at crates/cli/src/credential_handoff.rs:15
use super::{runtime_overrides_for_provider, xai_auth_diagnostics};
use anyhow::{Context, Result, bail, ensure};
use codewhale_config::{
CliRuntimeOverrides, ConfigStore, ProviderKind, RuntimeApiKeySource,
auth_mode_uses_kimi_imported_token,
};
use codewhale_secrets::Secrets;
use std::io::{ErrorKind, Write};
use zeroize::Zeroizing;
const TERMINAL_REFUSAL: &str =
"refusing terminal output; pipe credential handoff to the intended local client";
pub(crate) fn prepare_stdout(stdout_is_terminal: bool) -> Result<()> {
ensure!(!stdout_is_terminal, TERMINAL_REFUSAL);
#[cfg(unix)]
// SAFETY: this one-shot CLI exits before another command can inherit it.
unsafe {
let _ = libc::signal(libc::SIGPIPE, libc::SIG_IGN);
}
Ok(())
}
pub(crate) fn resolve_api_key(
store: &ConfigStore,
secrets: &Secrets,
provider: ProviderKind,
runtime_overrides: &CliRuntimeOverrides,
) -> Result<String> {
let resolved = store.config.resolve_runtime_options_with_secrets(
&runtime_overrides_for_provider(runtime_overrides, provider),
secrets,
);View on GitHub (pinned to 0c42157ee5)
Solutions
- Pipe stdout to the intended local client instead of a terminal, e.g. `codewhale ... | client-ingest`.
- Redirect stdout to a file or FIFO consumed by the local client process.
- Capture stdout programmatically from the parent process (piped ChildStdout).
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/cli/src/credential_handoff.rs:15 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/e14b922c58b2b144.
Report an issue: GitHub.