{"record":{"id":"186d31890b8dd516","repo":"LemmyNet/lemmy","slug":"object-must-have-name-or-content","errorCode":null,"errorMessage":"Object must have name or content","messagePattern":"Object must have name or content","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/apub/objects/src/objects/post.rs","lineNumber":248,"sourceCode":"      .clone()\n      .or_else(|| {\n        // Posts coming from Mastodon or similar platforms don't have a title. Instead we take the\n        // first line of the content and convert it from HTML to plaintext. We also remove mentions\n        // of the community name.\n        let c = page\n          .content\n          .as_deref()\n          .map(StringReader::new)\n          .map(|c| from_read_with_decorator(c, MAX_TITLE_LENGTH, TrivialDecorator::new()))?;\n        c.unwrap_or_default().lines().next().map(|s| {\n          s.replace(&format!(\"@{}\", community.name), \"\")\n            .trim()\n            .to_string()\n        })\n      })\n      .map(|n| remove_slurs(&n, &slur_regex))\n      .map(|n| truncate_for_db(&n, MAX_TITLE_LENGTH))\n      .ok_or_else(|| anyhow!(\"Object must have name or content\"))?;\n\n    let first_attachment = page.attachment.first();\n    let url = if let Some(attachment) = first_attachment.cloned() {\n      Some(attachment.url())\n    } else if page.kind == PageType::Video {\n      // we cant display videos directly, so insert a link to external video page\n      Some(page.id.inner().clone())\n    } else {\n      None\n    };\n\n    let url_blocklist = get_url_blocklist(context).await?;\n\n    let url = if let Some(url) = url {\n      is_url_blocked(&url, &url_blocklist)?;\n      is_valid_url(&url)?;\n      if page.kind != PageType::Video {\n        to_local_url(url.as_str(), context).await.or(Some(url))","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/LemmyNet/lemmy/blob/439734dd638a2c06a2f907beab7dcf4646e88f86/crates/apub/objects/src/objects/post.rs#L230-L266","documentation":"Validation error in Post::from_json: the incoming ActivityPub Page object has neither a `name` (title) nor usable `content` from which a title could be derived, so a required post title cannot be constructed. It fires when converting a federated post whose payload lacks both fields; the input at fault is the remote Page object's name/content.","triggerScenarios":"Thrown at crates/apub/objects/src/objects/post.rs:248 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reject the federated post as invalid; senders must include at least a name or content.","Ask the source platform (e.g. Mastodon-like) to provide a title or non-empty content.","Add leniency upstream: derive a placeholder title from attachments/summary instead of failing."],"exampleFix":null,"handlingStrategy":"validation","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-14T00:17:10.932Z"}