pbakaus/impeccable · info

{question} [Y/n]

Error message

{question} [Y/n] 

What it means

confirm() is scan_targets' interactive JS-style confirmation. Before reading a line from stdin it writes the prompt "<question> [Y/n] " to stderr and flushes it. This string is the prompt itself, not an error; it appears whenever a directory target with >50 files is scanned on a TTY, or in any other call site that needs explicit user consent before proceeding.

Source

Thrown at crates/detect/src/cli.rs:828

            if should_ignore_detection_file(&resolved, &cwd, &ctx.config) {
                continue;
            }
            let opts = ctx.scan_options_for(Some(&resolved));
            match ctx.detect_local_file(&resolved, &opts) {
                Ok(f) => all.extend(f),
                Err(e) => {
                    let message = e.message.clone();
                    ctx.report_local_scan_failure(target, &message);
                }
            }
        }
    }
    Ok(())
}

/// JS `confirm(question)`: readline on a TTY stdin, prompt to stderr.
fn confirm(io: &mut Io, question: &str) -> bool {
    io.err(&format!("{question} [Y/n] "));
    let _ = io.stderr.flush();
    let mut answer = String::new();
    // Only reached when stdin is a TTY, so a direct line read is what the
    // JS readline does too.
    let _ = std::io::stdin().read_line(&mut answer);
    let a = impeccable_core::js::trim(&answer);
    a.is_empty() || a.eq_ignore_ascii_case("y") || a.eq_ignore_ascii_case("yes")
}

fn stderr_is_tty() -> bool {
    #[cfg(unix)]
    {
        extern "C" {
            fn isatty(fd: i32) -> i32;
        }
        unsafe { isatty(2) == 1 }
    }
    #[cfg(not(unix))]

View on GitHub (pinned to 2bc2879276)

Solutions

  1. Answer 'Y' and press Enter to proceed, or 'n' to abort
  2. Redirect stdin from /dev/null or use non-TTY invocation in scripts so the prompt path is skipped
  3. Use --json or --quiet flags to suppress interactive confirmation
  4. Narrow the scan target below 50 files to avoid the prompt

Example fix

// before (hangs in CI with PTY)
$ impeccable detect .
Continue? [Y/n]

// after (script-safe)
$ impeccable detect . < /dev/null
# or
$ impeccable detect --json .
Defensive patterns

Strategy: fallback

Validate before calling

if (process.stdin.isTTY && !flags.json && !flags.quiet) {
  console.warn('detect may block on a Continue? [Y/n] prompt');
}

Try / catch

// Set a timeout when the process may be waiting on stdin
const child = spawn('impeccable', ['detect', dir]);
const t = setTimeout(() => child.kill(), 30000);
child.on('exit', () => clearTimeout(t));

Prevention

When it happens

Trigger: `impeccable detect <dir>` where the directory has more than 50 scannable files, stdin is a TTY, and JSON/quiet modes are off — the prompt text is emitted to stderr and the process blocks waiting for one line of stdin.

Common situations: Interactive terminal scans of large directories; CI systems that allocate a PTY causing the tool to think it is interactive and hang waiting for input; automated wrappers that do not answer the prompt.

Understand the failure class

Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.

Related errors


AI-assisted analysis of pbakaus/impeccable@2bc2879276 (2026-09-08). Data as JSON: /api/errors/bd20294c2a4bbb48. Report an issue: GitHub.