{"record":{"id":"1826c50f038722d8","repo":"tinyhumansai/openhuman","slug":"failed-to-read-stdin-e","errorCode":null,"errorMessage":"failed to read stdin: {e}","messagePattern":"failed to read stdin: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/memory/tree/tree_runtime/cli.rs","lineNumber":134,"sourceCode":"        println!();\n        println!(\"  <namespace>          Target namespace for the summary tree\");\n        println!(\"  --content, -c <text> Raw text content to ingest\");\n        println!(\"  --file, -f <path>    Read content from a file (use - for stdin)\");\n        println!(\"  -v, --verbose        Enable debug logging\");\n        println!();\n        println!(\"Either --content or --file is required. If both are given, --file wins.\");\n        return Ok(());\n    }\n\n    let namespace = &rest[0];\n\n    let content = if let Some(ref path) = opts.file {\n        if path == \"-\" {\n            use std::io::Read;\n            let mut buf = String::new();\n            std::io::stdin()\n                .read_to_string(&mut buf)\n                .map_err(|e| anyhow::anyhow!(\"failed to read stdin: {e}\"))?;\n            buf\n        } else {\n            std::fs::read_to_string(path)\n                .map_err(|e| anyhow::anyhow!(\"failed to read '{}': {e}\", path))?\n        }\n    } else if let Some(ref text) = opts.content {\n        text.clone()\n    } else {\n        return Err(anyhow::anyhow!(\n            \"either --content or --file is required. Run `openhuman tree-summarizer ingest --help`.\"\n        ));\n    };\n\n    if content.trim().is_empty() {\n        return Err(anyhow::anyhow!(\"content is empty\"));\n    }\n\n    init_logging(opts.verbose);","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/memory/tree/tree_runtime/cli.rs#L116-L152","documentation":"Reading raw text from stdin (invoked by passing `--file -` to the tree-summarizer ingest subcommand) hit an I/O error. Stdin is consumed with `read_to_string`, so this fires when the pipe is broken (e.g. `echo foo | head -c 0` closing early), stdin is a terminal with no input redirected, or the input stream contains invalid UTF-8 — the byte-level failure is chained in the message.","triggerScenarios":"Thrown at src/openhuman/memory/tree/tree_runtime/cli.rs:134 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that stdin is actually piped or redirected: `cat file.txt | openhuman tree-summarizer ingest ns --file -`","If feeding from another command, make sure that command exits successfully and writes valid UTF-8","For a regular file, pass `--file <path>` instead of routing it through stdin"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}