block/buzz · error

mentions a-shared

Error message

mentions a-shared

What it means

Panic from `.expect("mentions a-shared")` on `insert_mentions(...)` in the community-routing test. insert_mentions returns a Result; Err means the mention rows for event `a_shared` in community A failed to insert (constraint violation, pool/connection failure, or schema mismatch).

Source

Thrown at crates/buzz-db/src/runtime/tests.rs:1938

            .sign_with_keys(&author)
            .expect("sign event")
    };
    let tagged = |content: &str, secs: u64| tagged_kind(9, content, secs);

    let base = 1_700_000_000u64;
    // Shared rows (both DBs) + replica-only rows (divergence) per community.
    let a_shared = tagged("a-shared", base);
    let b_shared = tagged("b-shared", base + 1);
    for pool in [&writer, &replica] {
        insert_top_level(pool, comm_a, chan_a, &a_shared).await;
        insert_mentions(
            pool,
            CommunityId::from_uuid(comm_a),
            &a_shared,
            Some(chan_a),
        )
        .await
        .expect("mentions a-shared");
        insert_top_level(pool, comm_b, chan_b, &b_shared).await;
        insert_mentions(
            pool,
            CommunityId::from_uuid(comm_b),
            &b_shared,
            Some(chan_b),
        )
        .await
        .expect("mentions b-shared");
    }
    let a_replica_only = tagged("a-replica-only", base + 10);
    let b_replica_only = tagged("b-replica-only", base + 11);
    insert_top_level(&replica, comm_a, chan_a, &a_replica_only).await;
    insert_mentions(
        &replica,
        CommunityId::from_uuid(comm_a),
        &a_replica_only,
        Some(chan_a),

View on GitHub (pinned to dad5a33865)

Solutions

  1. Ensure a running Postgres and correct DATABASE_URL before running ignored tests
  2. Run migrations on the scratch DB before inserts (insert_top_level first, then insert_mentions)
  3. Check the returned error message inside the expect to distinguish FK vs connection errors

Example fix

// before
.await.expect("mentions a-shared");
// after
.await.unwrap_or_else(|e| panic!("mentions a-shared: {e}"));
Defensive patterns

Strategy: try-catch

Validate before calling

sqlx::query("SELECT 1").execute(pool).await?; // pool liveness before seeding
// ensure parent event exists:
assert!(fetch_event(pool, &a_shared.id).await.is_some(), "parent event must exist before insert_mentions");

Try / catch

insert_mentions(pool, comm_a, &a_shared, Some(chan_a)).await
    .unwrap_or_else(|e| panic!("mentions a-shared: {e}"));

Prevention

When it happens

Trigger: insert_mentions called with CommunityId comm_a and event a_shared while Postgres is down, the events/mentions schema is missing, or the event was not inserted first (FK failure).

Common situations: Integration test run without the required Postgres, stale migrations in the scratch DB, inserting mentions before the parent event exists.

Related errors


AI-assisted analysis of block/buzz@dad5a33865 (2026-08-30). Data as JSON: /api/errors/eae42dddaca14e7e. Report an issue: GitHub.