{"record":{"id":"1828ed3bda84f04e","repo":"sigoden/aichat","slug":"no-input","errorCode":null,"errorMessage":"No input","messagePattern":"No input","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":347,"sourceCode":"    config: &GlobalConfig,\n    text: Option<String>,\n    file: &[String],\n    abort_signal: AbortSignal,\n) -> Result<Input> {\n    let input = if file.is_empty() {\n        Input::from_str(config, &text.unwrap_or_default(), None)\n    } else {\n        Input::from_files_with_spinner(\n            config,\n            &text.unwrap_or_default(),\n            file.to_vec(),\n            None,\n            abort_signal,\n        )\n        .await?\n    };\n    if input.is_empty() {\n        bail!(\"No input\");\n    }\n    Ok(input)\n}\n\nfn setup_logger(is_serve: bool) -> Result<()> {\n    let (log_level, log_path) = Config::log_config(is_serve)?;\n    if log_level == LevelFilter::Off {\n        return Ok(());\n    }\n    let crate_name = env!(\"CARGO_CRATE_NAME\");\n    let log_filter = match std::env::var(get_env_name(\"log_filter\")) {\n        Ok(v) => v,\n        Err(_) => match is_serve {\n            true => format!(\"{crate_name}::serve\"),\n            false => crate_name.into(),\n        },\n    };\n    let config = ConfigBuilder::new()","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/sigoden/aichat/blob/82976d349ad97ac9aae0655ad631dace5e2a6385/src/main.rs#L329-L365","documentation":"`create_input` produced an `Input` that `is_empty()` — no text, file contents, or other source contributed anything — so there is nothing to send to the model. The library bails early rather than issuing an empty request.","triggerScenarios":"No prompt argument given, `-f/--file` points to an empty file, or all input sources resolve to empty when `create_input` is called by `run`.","commonSituations":"Empty or whitespace-only prompt; the file passed with -f is empty; shell variable interpolation produced an empty string (`mytool \"$EMPTY_VAR\"`).","solutions":["Provide non-empty prompt text or a non-empty input file","Verify the file passed to -f has content","Check shell variables/streams feeding the prompt for emptiness"],"exampleFix":"// before\nmytool \"$MSG\"   # MSG is empty\n// after\n[ -n \"$MSG\" ] && mytool \"$MSG\" || echo \"MSG is empty\"","handlingStrategy":"validation","validationCode":"if text.trim().is_empty()\n    && std::fs::metadata(&file_path).map(|m| m.len() == 0).unwrap_or(true)\n{\n    eprintln!(\"no input: prompt and file are both empty\");\n}","typeGuard":null,"tryCatchPattern":"match create_input(...).await {\n    Err(e) if e.to_string() == \"No input\" => {\n        eprintln!(\"Nothing to send: check prompt text and -f file contents\");\n    }\n    other => other?,\n}","preventionTips":["Confirm shell variables feeding the prompt are non-empty","Check -f files are non-empty before invoking","Trim whitespace and validate input in wrapper scripts"],"tags":["input","cli","empty"],"backgroundTag":"empty-required-field","analyzedSha":"82976d349ad97ac9aae0655ad631dace5e2a6385","analyzedAt":"2026-09-09T18:33:06.139Z","contentChangedAt":"2026-09-09T18:33:06.139Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}