tinyhumansai/openhuman · error

failed to read '{}': {e}

Error message

failed to read '{}': {e}

What it means

`std::fs::read_to_string` failed on the file path given via `--file`. This is a filesystem-level failure: the path does not exist, is a directory rather than a file, lacks read permissions, or the file contents are not valid UTF-8. The offending path is interpolated into the message so the user can immediately see which file failed.

Source

Thrown at src/openhuman/memory/tree/tree_runtime/cli.rs:138

        println!("  -v, --verbose        Enable debug logging");
        println!();
        println!("Either --content or --file is required. If both are given, --file wins.");
        return Ok(());
    }

    let namespace = &rest[0];

    let content = if let Some(ref path) = opts.file {
        if path == "-" {
            use std::io::Read;
            let mut buf = String::new();
            std::io::stdin()
                .read_to_string(&mut buf)
                .map_err(|e| anyhow::anyhow!("failed to read stdin: {e}"))?;
            buf
        } else {
            std::fs::read_to_string(path)
                .map_err(|e| anyhow::anyhow!("failed to read '{}': {e}", path))?
        }
    } else if let Some(ref text) = opts.content {
        text.clone()
    } else {
        return Err(anyhow::anyhow!(
            "either --content or --file is required. Run `openhuman tree-summarizer ingest --help`."
        ));
    };

    if content.trim().is_empty() {
        return Err(anyhow::anyhow!("content is empty"));
    }

    init_logging(opts.verbose);

    let rt = build_runtime()?;
    rt.block_on(async {
        let config = load_config().await?;

View on GitHub (pinned to 7491200858)

Solutions

  1. Verify the path exists and is readable: `ls -la <path>`
  2. Pass an absolute path to avoid working-directory ambiguity
  3. If the file is not UTF-8 text (e.g. a binary or non-UTF-8 encoding), convert or re-save it as UTF-8 first
  4. Use `--content "..."` directly for short inline text instead of a file
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/openhuman/memory/tree/tree_runtime/cli.rs:138 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/f54a641fdf1e209c. Report an issue: GitHub.