GitoxideLabs/gitoxide · error · anyhow::Error

At least one object couldn't be looked up even though it…

Error message

At least one object couldn't be looked up even though it must exist

What it means

During threaded or single-threaded object lookups the command tracks per-object errors; after processing it checks whether any lookup reported an error and fails the whole run, because every supplied object id was expected to already exist in the object database.

Solutions

  1. Run `gix repo odb` integrity/verify to find which objects fail, then repair or re-fetch the affected pack.
  2. Check the progress/stderr output for the specific failing object id and whether the corresponding pack data file exists.
  3. Re-download or re-pack the repository (`git gc` / fresh clone) if the store is corrupt.

Example fix

// caller-side handling
match gix_repo_odb_statistics(&ids) {
    Err(e) if e.to_string().contains("couldn't be looked up") => {
        verify_and_repair_odb()?; // locate missing pack objects, re-clone if needed
    }
    r => r?,
}
Defensive patterns

Strategy: try-catch

Try / catch

match odb_statistics(ids) {
    Err(e) if e.to_string().contains("couldn't be looked up") => {
        run_integrity_check_and_repair()?;
    }
    r => r?,
}

Prevention

When it happens

Trigger: `statistics()` finishes iterating `object_ids` and `errors.contains(&true)` — at least one id (from pack index or explicit input) could not be looked up, e.g. due to a missing/corrupt pack or interruption mid-run.

Common situations: Verifying a pack file whose companion pack/idx is missing or truncated; corrupted object store; interrupted downloads leaving partial packs; cancellation during the run.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08). Data as JSON: /api/errors/65aed660df52d201. Report an issue: GitHub.

Appendix: source

Thrown at gitoxide-core/src/repository/odb.rs:254

            {
                let objects = repo.objects.clone();
                move |_| (objects.clone().into_inner(), counter, false)
            },
            |id, (odb, counter, has_error), _threads_left, _stop_everything| -> anyhow::Result<()> {
                counter.fetch_add(1, Ordering::Relaxed);
                if let Err(_err) = odb.header(id) {
                    *has_error = true;
                    gix::trace::error!(err = ?_err, "Object that is known to be present wasn't found");
                }
                Ok(())
            },
            || Some(std::time::Duration::from_millis(100)),
            |(_, _, has_error)| has_error,
        )?;

        progress.show_throughput(start);
        if errors.contains(&true) {
            bail!("At least one object couldn't be looked up even though it must exist");
        }
    }

    #[cfg(feature = "serde")]
    {
        serde_json::to_writer_pretty(out, &stats)?;
    }

    Ok(())
}

pub fn entries(repo: gix::Repository, format: OutputFormat, mut out: impl io::Write) -> anyhow::Result<()> {
    if format != OutputFormat::Human {
        bail!("Only human output format is supported at the moment");
    }

    for object in repo.objects.iter()? {
        let object = object?;

View on GitHub (pinned to e73179060b)