{"record":{"id":"e8abefdf93f54c8a","repo":"LemmyNet/lemmy","slug":"private-message-is-not-part-of-community","errorCode":null,"errorMessage":"Private message is not part of community","messagePattern":"Private message is not part of community","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/apub/activities/src/protocol/deletion/delete.rs","lineNumber":66,"sourceCode":"  /// Nonstandard field denoting that the replies to an `Object` should be removed along with the\n  /// `Object`. Only valid for `Pages` and `Notes`.\n  // See here for discussion of this:\n  // https://activitypub.space/topic/78/deleting-a-post-vs-deleting-an-entire-comment-tree\n  pub(crate) with_replies: Option<bool>,\n}\n\nimpl InCommunity for Delete {\n  async fn community(&self, context: &Data<LemmyContext>) -> LemmyResult<ApubCommunity> {\n    let community_id = match DeletableObjects::read_from_db(self.object.id(), context).await? {\n      DeletableObjects::Community(c) => c.id,\n      DeletableObjects::Comment(c) => {\n        let post = Post::read(&mut context.pool(), c.post_id).await?;\n        post.community_id\n      }\n      DeletableObjects::Post(p) => p.community_id,\n      DeletableObjects::Person(_) => return Err(anyhow!(\"Person is not part of community\").into()),\n      DeletableObjects::PrivateMessage(_) => {\n        return Err(anyhow!(\"Private message is not part of community\").into());\n      }\n    };\n    let community = Community::read(&mut context.pool(), community_id).await?;\n    if let Some(audience) = &self.audience {\n      verify_urls_match(audience.inner(), community.ap_id.inner())?;\n    }\n    Ok(community.into())\n  }\n}\n\nimpl Id for Delete {\n  fn id(&self) -> &Url {\n    &self.id\n  }\n}\n","sourceCodeStart":48,"sourceCodeEnd":82,"githubUrl":"https://github.com/LemmyNet/lemmy/blob/439734dd638a2c06a2f907beab7dcf4646e88f86/crates/apub/activities/src/protocol/deletion/delete.rs#L48-L82","documentation":"Protocol validation error in Delete::community: the Delete activity's object resolves to a PrivateMessage, which does not belong to any community, so resolving the owning community fails. It fires when a received Delete activity targets a private message via this community-scoped verification path; the input at fault is the activity's `object` field referencing a private message.","triggerScenarios":"Thrown at crates/apub/activities/src/protocol/deletion/delete.rs:66 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Route private-message deletions through a dedicated handler that skips community verification.","Verify senders address private-message Deletes outside the InCommunity flow.","Add an explicit match arm for private messages before requiring a community id."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"439734dd638a2c06a2f907beab7dcf4646e88f86","analyzedAt":"2026-09-06T11:28:35.035Z","contentChangedAt":"2026-09-06T11:28:35.035Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}