LemmyNet/lemmy · error

Person is not part of community

Error message

Person is not part of community

What it means

Protocol validation error in Delete::community: the Delete activity's object resolves to a Person, which cannot be routed through the InCommunity trait, so the community lookup fails. It fires when a received Delete activity targets an actor (account deletion) rather than a community-contained object; the input at fault is the activity's `object` field pointing at a person instead of a community item.

Source

Thrown at crates/apub/activities/src/protocol/deletion/delete.rs:64

  /// user should be deleted along with the account
  pub(crate) remove_data: Option<bool>,
  /// Nonstandard field denoting that the replies to an `Object` should be removed along with the
  /// `Object`. Only valid for `Pages` and `Notes`.
  // See here for discussion of this:
  // https://activitypub.space/topic/78/deleting-a-post-vs-deleting-an-entire-comment-tree
  pub(crate) with_replies: Option<bool>,
}

impl InCommunity for Delete {
  async fn community(&self, context: &Data<LemmyContext>) -> LemmyResult<ApubCommunity> {
    let community_id = match DeletableObjects::read_from_db(self.object.id(), context).await? {
      DeletableObjects::Community(c) => c.id,
      DeletableObjects::Comment(c) => {
        let post = Post::read(&mut context.pool(), c.post_id).await?;
        post.community_id
      }
      DeletableObjects::Post(p) => p.community_id,
      DeletableObjects::Person(_) => return Err(anyhow!("Person is not part of community").into()),
      DeletableObjects::PrivateMessage(_) => {
        return Err(anyhow!("Private message is not part of community").into());
      }
    };
    let community = Community::read(&mut context.pool(), community_id).await?;
    if let Some(audience) = &self.audience {
      verify_urls_match(audience.inner(), community.ap_id.inner())?;
    }
    Ok(community.into())
  }
}

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

View on GitHub (pinned to 439734dd63)

Solutions

  1. Handle person/account deletions on a separate code path instead of requiring community membership.
  2. Ensure senders only emit community-scoped Delete activities through this verification path.
  3. Inspect DeletableObjects::read_from_db output and branch on Person before calling InCommunity.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/apub/activities/src/protocol/deletion/delete.rs:64 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/f5e83c6aff1aa307. Report an issue: GitHub.