tinyhumansai/openhuman · error

expected one top-level folder under {}, found none

Error message

expected one top-level folder under {}, found none

What it means

Thrown by find_single_top_level() after extracting a python-build-standalone tarball: the extract root contains zero top-level directories. The extractor's contract is that the archive unpacks to exactly one folder (e.g. cpython-3.x.y+.../) which is then renamed into place. Zero directories means the archive was empty, the download was corrupt/truncated, or the wrong artifact was extracted — a generic integrity guard where the faulty input is the extracted directory contents.

Source

Thrown at src/openhuman/runtime/python/extractor.rs:51

    .context("spawn_blocking join failure during extraction")?
}

fn find_single_top_level(extract_root: &Path) -> Result<PathBuf> {
    let mut entries = fs::read_dir(extract_root)
        .with_context(|| format!("listing {}", extract_root.display()))?
        .collect::<Result<Vec<_>, _>>()
        .with_context(|| format!("reading entries of {}", extract_root.display()))?;
    entries.sort_by_key(|e| e.file_name());

    let mut dirs = entries
        .into_iter()
        .filter(|e| e.file_type().map(|t| t.is_dir()).unwrap_or(false))
        .map(|e| e.path())
        .collect::<Vec<_>>();

    match dirs.len() {
        1 => Ok(dirs.pop().expect("single dir")),
        0 => Err(anyhow!(
            "expected one top-level folder under {}, found none",
            extract_root.display()
        )),
        n => Err(anyhow!(
            "expected one top-level folder under {}, found {n}",
            extract_root.display()
        )),
    }
}

pub async fn atomic_install(staged: &Path, final_dest: &Path) -> Result<PathBuf> {
    let staged = staged.to_path_buf();
    let final_dest = final_dest.to_path_buf();

    tokio::task::spawn_blocking(move || -> Result<PathBuf> {
        if let Some(parent) = final_dest.parent() {
            fs::create_dir_all(parent)
                .with_context(|| format!("creating parent {}", parent.display()))?;

View on GitHub (pinned to 7491200858)

Solutions

  1. Delete the extract root and re-download the distribution, verifying the sha256 against expected_sha256 before extracting.
  2. Verify the artifact name/URL corresponds to an install_only tarball, not a source or docs archive.
  3. Check available disk space — an extraction that silently failed can leave an empty directory.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/runtime/python/extractor.rs:51 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/66e2354d8d573089. Report an issue: GitHub.