bee-san/Ciphey · error

Error. No input was provided. Please use ciphey --help

Error message

Error. No input was provided. Please use ciphey --help

What it means

Ciphey's CLI entry point parse_cli_args (src/cli/mod.rs:92) panics when clap parsing succeeds but neither -t/--text nor -f/--file was supplied. There is no default input mode and no stdin-reading fallback, so the match on (file, text) reaches the (None, None) arm and aborts the process with this message. It is a hard startup abort, not a recoverable library error.

Source

Thrown at src/cli/mod.rs:92

    let min_log_level = match opts.verbose {
        0 => "Warn",
        1 => "Info",
        2 => "Debug",
        _ => "Trace",
    };
    env_logger::init_from_env(
        env_logger::Env::default().filter_or(env_logger::DEFAULT_FILTER_ENV, min_log_level),
    );

    let input_text: String = match (opts.file.take(), opts.text.take()) {
        (Some(_), Some(_)) => {
            panic_failure_both_input_and_fail_provided();
            unreachable!("panic helper should terminate the process");
        }
        (Some(file), None) => read_and_parse_file(file),
        (None, Some(text)) => text,
        (None, None) => {
            panic!("Error. No input was provided. Please use ciphey --help")
        }
    };

    trace!("Program was called with CLI 😉");
    trace!("Parsed the arguments");
    trace!("The inputted text is {}", &input_text);

    cli_args_into_config_struct(opts, input_text)
}

/// When the CLI is called with `-f` to open a file
/// this function opens it
pub fn read_and_parse_file(file_path: String) -> String {
    let mut file = File::open(&file_path).unwrap_or_else(|err| {
        eprintln!("Error: Cannot open file '{}': {}", file_path, err);
        std::process::exit(1);
    });

View on GitHub (pinned to 39864898d2)

Solutions

  1. Pass the ciphertext inline: `ciphey -t "<ciphertext>"`, or point at a file: `ciphey -f cipher.txt`
  2. If you meant to pipe input, this CLI does not read stdin automatically — capture it first: `ciphey -t "$(cat cipher.txt)"` or write a temp file and use -f
  3. Run `ciphey --help` to confirm the exact flags your build accepts

Example fix

# before
ciphey
# after
ciphey -t "SGVsbG8="
Defensive patterns

Strategy: validation

Validate before calling

use clap::Parser;
let opts = Opts::parse();
if opts.file.is_none() && opts.text.is_none() {
    eprintln!("input required: pass -t <text> or -f <file>");
    std::process::exit(2);
}

Prevention

When it happens

Trigger: Invoking the binary with no input at all: `ciphey`, `ciphey -v`, `ciphey --wordlist list.txt` (flags that are not input sources). The pure trigger is a clap-parseable command line where both opts.file and opts.text are None.

Common situations: New users expecting an interactive prompt or stdin mode (neither exists); shell scripts where $CIPHERTEXT expands to empty or the -t flag was dropped during a refactor; CI jobs calling ciphey before wiring the input variable.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.


AI-assisted analysis of bee-san/Ciphey@39864898d2 (2026-08-22). Data as JSON: /api/errors/e18cc8079e7fce50. Report an issue: GitHub.