block/buzz · error
kick requires target_pubkey
Error message
kick requires target_pubkey
What it means
The 'kick' arm of `run_atomic_mutation` requires both `ctx.target_pubkey` and `ctx.channel_id` to be `Some`; this specific error fires when the target user is missing. A kick removes a specific user from a specific channel, so without a target the enforcement transaction aborts.
Source
Thrown at crates/buzz-relay/src/handlers/report_resolution.rs:725
.ok_or_else(|| anyhow::anyhow!("timeout requires timeout_until"))?;
state
.db
.execute_timeout_with_marker(
action_id,
lease_token,
ctx.community_id,
target,
ctx.actor_pubkey,
until,
ctx.reason,
)
.await
.map_err(|e| anyhow::anyhow!("timeout failed: {e}"))
}
"kick" => {
let target = ctx
.target_pubkey
.ok_or_else(|| anyhow::anyhow!("kick requires target_pubkey"))?;
let ch = ctx
.channel_id
.ok_or_else(|| anyhow::anyhow!("kick requires channel_id"))?;
match state
.db
.execute_kick_with_marker(
action_id,
lease_token,
ctx.community_id,
ch,
target,
ctx.actor_pubkey,
)
.await
.map_err(|e| anyhow::anyhow!("kick failed: {e}"))?
{
buzz_db::relay_admin_actions::KickWithMarkerResult::Removed => Ok(true),
buzz_db::relay_admin_actions::KickWithMarkerResult::AlreadyMarked => Ok(false),View on GitHub (pinned to eed74bde2f)
Solutions
- Ensure the kick action producer always records target_pubkey when enqueuing the action.
- Locate 'kick' action rows with NULL target_pubkey and fix or discard them.
- Add insert-time validation or a NOT NULL constraint on the kick target column.
- Verify the ActionCtx loader maps the kick target from the correct DB column.
Example fix
// before
actions::insert(Action { kind: "kick", channel_id: Some(ch), .. })?;
// after
actions::insert(Action {
kind: "kick",
target_pubkey: Some(offender_pubkey),
channel_id: Some(ch),
..
})?; Defensive patterns
Strategy: validation
Validate before calling
pub fn enqueue_kick(target: [u8; 32], channel_id: uuid::Uuid, reason: String) -> anyhow::Result<()> {
actions::insert(Action {
kind: "kick",
target_pubkey: Some(target),
channel_id: Some(channel_id),
reason,
..Default::default()
})?;
Ok(())
} Type guard
fn kick_target(ctx: &ActionCtx) -> Option<(&[u8; 32], uuid::Uuid)> {
let target = ctx.target_pubkey.as_ref().and_then(|b| b.try_into().ok())?;
Some((target, ctx.channel_id?))
} Try / catch
match run_atomic_mutation(&state, ctx).await {
Err(e) if e.to_string().contains("kick requires target_pubkey") => {
tracing::error!(action_id = %action_id, "malformed kick action: dropping");
mark_action_failed(action_id, "missing target_pubkey").await?;
}
Err(e) => return Err(e),
Ok(v) => Ok(v),
} Prevention
- Make target_pubkey and channel_id NOT NULL for kick action rows.
- Validate the kick payload (target + channel) when the moderation decision is created.
- Add an integration test driving the kick enforcement path.
- Verify the ctx loader reads the kick target from the correct column after schema changes.
When it happens
Trigger: A kick enforcement action row was enqueued or leased with `target_pubkey: None` — the producer omitted the user to kick, or the DB column was NULL when the driver loaded the context.
Common situations: Kick decision made from a report where the offender's pubkey was never captured; manually inserted kick rows during testing; ctx loader reading the wrong column; user record deletion cascading the target field to NULL.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- ban requires target_pubkey
- timeout requires target_pubkey
- timeout requires timeout_until
- ban failed: {e}
- timeout failed: {e}
AI-assisted analysis of block/buzz@eed74bde2f (2026-08-30).
Data as JSON: /api/errors/0990bbe3849921e5.
Report an issue: GitHub.