Morganamilo/paru · error

not yet implemented

Error message

not yet implemented

What it means

This error is a Rust `unimplemented!()` panic placeholder in the mock backend's `search_by` method. It means the mock implementation of the package-search trait was never fleshed out, so any call to `search_by` aborts the task instead of returning a real `Error`. It exists purely as a stub to satisfy the trait signature.

Solutions

  1. Implement the `search_by` body in src/mock.rs to return canned/deserialized `Package` data instead of `unimplemented!()`
  2. Route tests/code to a real backend implementation rather than the mock
  3. If search is intentionally unsupported by the mock, return `Err(Error::...)` explicitly instead of panicking with `unimplemented!()`

Example fix

// before
async fn search_by<S: AsRef<str> + Send + Sync>(&self, _pkg: S, _by: SearchBy) -> StdResult<Vec<Package>, Error> {
    unimplemented!()
}
// after
async fn search_by<S: AsRef<str> + Send + Sync>(&self, pkg: S, by: SearchBy) -> StdResult<Vec<Package>, Error> {
    Ok(self.packages.iter().filter(|p| p.matches(pkg.as_ref(), &by)).cloned().collect())
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Check backend type before searching
fn supports_search(backend: &dyn PkgBackend) -> bool {
    backend.as_any().type_id() != TypeId::of::<MockBackend>()
}

Type guard

fn is_mock(backend: &dyn PkgBackend) -> bool {
    backend.as_any().downcast_ref::<MockBackend>().is_some()
}

Try / catch

if is_mock(backend) {
    return Ok(Vec::new()); // or use a fixture-based search
}
let results = backend.search_by("ripgrep", SearchBy::Name).await?;

Prevention

When it happens

Trigger: Calling `search_by` on the mock backend defined in src/mock.rs (e.g. unit tests or code paths that route to the mock rather than a real backend). Any search performed against this mock hits the stub at src/mock.rs:100.

Common situations: Developers wiring up the mock in tests without realizing search is not mocked; integration code accidentally selecting the mock backend in production-like configurations.

Related errors


AI-assisted analysis of Morganamilo/paru@9ac3578807 (2026-09-12). Data as JSON: /api/errors/51eee32bac3b5c63. Report an issue: GitHub.

Appendix: source

Thrown at src/mock.rs:100

        pkgs: &[S],
    ) -> StdResult<Vec<Package>, Error> {
        let mut ret = Vec::new();

        for pkg in pkgs {
            if let Some(pkg) = self.pkgs.get(pkg.as_ref()) {
                ret.push(pkg.clone());
            }
        }

        Ok(ret)
    }

    async fn search_by<S: AsRef<str> + Send + Sync>(
        &self,
        _pkg: S,
        _by: SearchBy,
    ) -> StdResult<Vec<Package>, Error> {
        unimplemented!()
    }
}

View on GitHub (pinned to 9ac3578807)