chroma-core/chroma · critical

not implemented

Error message

not implemented

What it means

SysDb::get_collection_by_crn dispatches on the backend enum: Grpc and Test variants forward the call, but the Sqlite variant executes unimplemented!(), which panics (not an error value). get_collection_by_crn is a newer CRN-based (collection resource name) lookup that has only been implemented for the gRPC sysdb; calling it on the embedded/single-process SQLite sysdb kills the task/thread with a panic that unwinds as 'not implemented'.

Source

Thrown at rust/sysdb/src/sysdb.rs:237

        match self {
            SysDb::Grpc(grpc) => grpc.get_collections(options).await,
            SysDb::Sqlite(sqlite) => sqlite.get_collections(options).await,
            SysDb::Test(test) => test.get_collections(options).await,
        }
    }

    pub async fn get_collection_by_crn(
        &mut self,
        tenant_resource_name: String,
        database: String,
        name: String,
    ) -> Result<Collection, GetCollectionByCrnError> {
        match self {
            SysDb::Grpc(grpc) => {
                grpc.get_collection_by_crn(tenant_resource_name, database, name)
                    .await
            }
            SysDb::Sqlite(_) => unimplemented!(),
            SysDb::Test(test) => {
                test.get_collection_by_crn(tenant_resource_name, database, name)
                    .await
            }
        }
    }

    pub async fn count_collections(
        &mut self,
        tenant: String,
        database: Option<DatabaseName>,
    ) -> Result<usize, CountCollectionsError> {
        // TODO(Sanket): optimize sqlite and test implementation.
        match self {
            SysDb::Grpc(grpc) => grpc.count_collections(tenant, database).await,
            SysDb::Sqlite(sqlite) => Ok(sqlite
                .get_collections(GetCollectionsOptions {
                    tenant: Some(tenant),

View on GitHub (pinned to aecdd12c8a)

Solutions

  1. Route CRN lookups to the gRPC backend: configure the Rust server/sysdb client to use SysDb::Grpc (point it at a running sysdb service) instead of the embedded sqlite variant.
  2. For single-process sqlite deployments, avoid CRN-based resolution — use the non-CRN collection lookup APIs that the sqlite backend does implement.
  3. If you own the sqlite backend, implement get_collection_by_crn for SysDb::Sqlite (translate tenant/database/name to the existing sqlite query) instead of leaving unimplemented!().
  4. As a stopgap in tests, inject SysDb::Test with a mock that implements get_collection_by_crn so the panic path is never reached.

Example fix

// before
// sqlite-backed sysdb + CRN lookup -> panics: not implemented
let col = sysdb.get_collection_by_crn(tenant, db, name).await; // SysDb::Sqlite(_) hits unimplemented!()

// after
// guard the call by backend capability
if matches!(sysdb, SysDb::Sqlite(_)) {
    return Err(anyhow::anyhow!("CRN lookup requires the gRPC sysdb backend"));
}
let col = sysdb.get_collection_by_crn(tenant, db, name).await?;
Defensive patterns

Strategy: validation

Validate before calling

// Before any CRN lookup, assert the backend supports it.
fn ensure_crn_lookup_supported(sysdb: &SysDb) -> anyhow::Result<()> {
    if matches!(sysdb, SysDb::Sqlite(_)) {
        anyhow::bail!("get_collection_by_crn is only implemented for the gRPC sysdb backend");
    }
    Ok(())
}

ensure_crn_lookup_supported(&sysdb)?;
let collection = sysdb.get_collection_by_crn(tenant, db, name).await?;

Type guard

fn supports_get_collection_by_crn(sysdb: &SysDb) -> bool {
    !matches!(sysdb, SysDb::Sqlite(_))
}

Try / catch

// unimplemented!() panics, it does not return Err — catch_unwind is the only catch:
let result = std::panic::catch_unwind(std::assert_unwind_safe(|| {
    futures::executor::block_on(sysdb.get_collection_by_crn(t, d, n))
}));
match result {
    Ok(Ok(col)) => { /* use collection */ }
    Ok(Err(e)) => { /* real GetCollectionByCrnError */ }
    Err(panic) => { /* 'not implemented' from Sqlite variant — fix config, don't retry */ }
}

Prevention

When it happens

Trigger: Any code path that resolves a collection by CRN (tenant resource name + database + collection name) while running against the embedded SysDb::Sqlite backend — e.g. a single-node Rust server binary configured with the sqlite sysdb instead of the gRPC sysdb, or a test harness that uses the sqlite variant and then exercises CRN routing.

Common situations: Running the distributed/CRN-aware control plane against a local dev configuration that kept sqlite for simplicity; upgrading to a version where CRN lookups exist but the sqlite backend was never extended; integration tests sharing code with production routing logic hitting the unsupported branch.

Related errors


AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16). Data as JSON: /api/errors/f91d8fcc5ef970b3. Report an issue: GitHub.