{"record":{"id":"e3eb5d0efee650cc","repo":"pemistahl/grex","slug":"error-no-valid-input-could-be-found-whatsoever","errorCode":null,"errorMessage":"error: no valid input could be found whatsoever","messagePattern":"error: no valid input could be found whatsoever","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":323,"sourceCode":"                    .collect_vec())\n            } else {\n                Ok(cli.input.clone())\n            }\n        } else if let Some(file_path) = &cli.file_path {\n            let is_hyphen = file_path.as_os_str() == \"-\";\n            let path = if is_hyphen && is_stdin_available {\n                let mut stdin_file_path = String::new();\n                stdin().read_to_string(&mut stdin_file_path)?;\n                PathBuf::from(stdin_file_path.trim())\n            } else {\n                file_path.to_path_buf()\n            };\n            match std::fs::read_to_string(path) {\n                Ok(file_content) => Ok(file_content.lines().map(|it| it.to_string()).collect_vec()),\n                Err(error) => Err(error),\n            }\n        } else {\n            Err(Error::new(\n                ErrorKind::InvalidInput,\n                \"error: no valid input could be found whatsoever\",\n            ))\n        }\n    }\n\n    pub(crate) fn handle_input(\n        cli: &Cli,\n        input: Result<Vec<String>, Error>,\n    ) -> Result<(), Box<dyn std::error::Error>> {\n        match input {\n            Ok(test_cases) => {\n                let mut builder = RegExpBuilder::from(&test_cases);\n\n                if cli.is_digit_converted {\n                    builder.with_conversion_of_digits();\n                }\n","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/pemistahl/grex/blob/99cc347707375e00514f938b76d885a201dfc110/src/main.rs#L305-L341","documentation":"The CLI's obtain_input returns Err(ErrorKind::InvalidInput, \"error: no valid input could be found whatsoever\") when neither stdin piped input nor a file path argument could supply test cases. Without any input, main aborts with this message instead of building a regex. It is a CLI-level input-resolution failure, not a library panic.","triggerScenarios":"Running the binary with no piped stdin and no file path argument; stdin is a TTY (interactive terminal) so no piped data exists; the code path checks both sources and finds neither usable.","commonSituations":"Running `regexpbuilder` bare in a terminal instead of piping examples into it; a script's pipe upstream produced nothing so stdin appears empty/unavailable; forgetting the file argument in a CI job.","solutions":["Pipe test cases in via stdin: `cat examples.txt | regexpbuilder`","Pass the path to a file of test cases as the argument: `regexpbuilder examples.txt`","Fix the calling script so it always redirects stdin or supplies a file argument; add an argument-presence check before invoking the binary"],"exampleFix":"// before (shell)\nregexpbuilder\n// after (shell)\ncat examples.txt | regexpbuilder\n# or\nregexpbuilder examples.txt","handlingStrategy":"validation","validationCode":"let has_stdin = !atty::is(atty::Stream::Stdin);\nlet has_file = std::env::args().nth(1).is_some();\nif !has_stdin && !has_file { eprintln!(\"usage: regexpbuilder [file] (or pipe test cases on stdin)\"); std::process::exit(2); }","typeGuard":null,"tryCatchPattern":"match obtain_input() {\n    Ok(cases) => build_regex(cases),\n    Err(e) => { eprintln!(\"{}\", e); std::process::exit(2); },\n}","preventionTips":["Always pipe input or pass a file argument when running non-interactively","Use atty/is-terminal to detect an interactive TTY and print usage instead of proceeding","In scripts, guard with `[ -t 0 ]` or check argument count before invoking the binary"],"tags":["cli","missing-input","stdin"],"backgroundTag":"missing-cli-argument","analyzedSha":"99cc347707375e00514f938b76d885a201dfc110","analyzedAt":"2026-09-13T15:42:56.144Z","contentChangedAt":"2026-09-13T15:42:56.144Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}