LemmyNet/lemmy · error

activity is not in community

Error message

activity is not in community

What it means

Protocol validation error in BlockUser::community: the block activity's `target` could not be dereferenced to / resolved as the community the activity claims to apply to, i.e. the activity is not addressed to (in) a community. It fires when a received Block activity's target does not resolve to a valid ApubCommunity; the input at fault is the activity's target field.

Source

Thrown at crates/apub/activities/src/protocol/block/block_user.rs:48

  pub(crate) target: ObjectId<SiteOrCommunity>,
  #[serde(rename = "type")]
  pub(crate) kind: BlockType,
  pub(crate) id: Url,

  /// Quick and dirty solution.
  /// TODO: send a separate Delete activity instead
  pub(crate) remove_data: Option<bool>,
  /// block reason, written to mod log
  pub(crate) summary: Option<String>,
  pub(crate) end_time: Option<DateTime<Utc>>,
  pub(crate) audience: Option<ObjectId<ApubCommunity>>,
}

impl InCommunity for BlockUser {
  async fn community(&self, context: &Data<LemmyContext>) -> LemmyResult<ApubCommunity> {
    let target = self.target.dereference(context).await?;
    let SiteOrCommunity::Right(community) = target else {
      return Err(anyhow!("activity is not in community").into());
    };
    if let Some(audience) = &self.audience {
      verify_urls_match(audience.inner(), community.ap_id.inner())?;
    }
    Ok(community)
  }
}

impl Id for BlockUser {
  fn id(&self) -> &Url {
    &self.id
  }
}

View on GitHub (pinned to 439734dd63)

Solutions

  1. Reject or drop the malformed Block activity; senders must target a community object.
  2. Verify the sending server addresses block activities with a valid community `target`/audience.
  3. Check that the target community exists locally or can be dereferenced via ActivityPub.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/apub/activities/src/protocol/block/block_user.rs:48 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of LemmyNet/lemmy@439734dd63 (2026-09-06). Data as JSON: /api/errors/2d110e3373086b3e. Report an issue: GitHub.