{"record":{"id":"c24dfb54d1ad3b20","repo":"block/buzz","slug":"d-tag","errorCode":null,"errorMessage":"d tag","messagePattern":"d tag","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/buzz-db/src/store/channel_members.rs","lineNumber":3171,"sourceCode":"        let owner = owner_keys.public_key().to_bytes();\n        seed_community_channel(&pool, community_uuid, channel, &owner_keys).await;\n        let member = Keys::generate().public_key().to_bytes();\n        sqlx::query(\n            \"INSERT INTO channel_members (community_id, channel_id, pubkey, role, invited_by) \\\n             VALUES ($1, $2, $3, 'admin', $4)\",\n        )\n        .bind(community_uuid)\n        .bind(channel)\n        .bind(member.as_slice())\n        .bind(owner.as_slice())\n        .execute(&pool)\n        .await\n        .expect(\"seed canonical admin\");\n\n        let roster = |role: &str, timestamp| {\n            EventBuilder::new(Kind::Custom(39002), \"\")\n                .tags(vec![\n                    Tag::parse([\"d\", channel.to_string().as_str()]).expect(\"d tag\"),\n                    Tag::parse([\"p\", hex::encode(owner).as_str(), \"\", \"owner\"])\n                        .expect(\"owner p tag\"),\n                    Tag::parse([\"p\", hex::encode(member).as_str(), \"\", role])\n                        .expect(\"member p tag\"),\n                ])\n                .custom_created_at(Timestamp::from(timestamp))\n                .sign_with_keys(&relay_keys)\n                .expect(\"sign roster\")\n        };\n        let base = Timestamp::now().as_secs();\n        let fresh = roster(\"admin\", base);\n        assert!(\n            db.replace_addressable_event(community, &fresh, Some(channel))\n                .await\n                .expect(\"publish canonical role\")\n                .1\n        );\n        let stale = roster(\"member\", base + 1);","sourceCodeStart":3153,"sourceCodeEnd":3189,"githubUrl":"https://github.com/block/buzz/blob/dad5a33865fc81a2e55b3b60746632f615ec1e3a/crates/buzz-db/src/store/channel_members.rs#L3153-L3189","documentation":"The test builds kind:39002 roster events and parses the channel d tag with Tag::parse([\"d\", channel.to_string()]). The expect panics when nostr's Tag::parse rejects the tag — the tag array is empty, or (for certain tag kinds) a required component like the pubkey/value is invalid. For d tags this usually means the value failed validation in the nostr crate version in use.","triggerScenarios":"Tag::parse returning Err for [\"d\", channel.to_string()] when channel.to_string() yields an empty or malformed value, or the nostr crate version validates d-tag values more strictly than the test anticipates.","commonSituations":"Upgrading the nostr crate changed Tag::parse validation (e.g. rejecting empty values or new length limits); passing a Uuid formatting that includes characters a version rejects; constructing the tag with wrong arity.","solutions":["Print channel.to_string() to confirm it is a non-empty, expected-format value","Check the nostr crate's Tag::parse docs/changelog for stricter validation in the pinned version","Construct the tag directly (Tag::custom) if generic parsing is too strict for a valid test value","Ensure `d tag` isn't shadowed by another binding in scope (see error 83's `slash` shadow note)"],"exampleFix":"// before\nTag::parse([\"d\", channel.to_string().as_str()]).expect(\"d tag\"),\n// after\nlet d_tag = Tag::parse([\"d\", channel.to_string().as_str()])\n    .unwrap_or_else(|e| panic!(\"d tag parse failed for '{}': {e}\", channel));","handlingStrategy":"validation","validationCode":"let d = channel.to_string();\nassert!(!d.is_empty(), \"d tag value must be non-empty\");","typeGuard":"fn parseable_tag(parts: [&str; 2]) -> bool {\n    nostr::Tag::parse(parts).is_ok()\n}","tryCatchPattern":"let d_tag = Tag::parse([\"d\", channel.to_string().as_str()])\n    .unwrap_or_else(|e| panic!(\"d tag parse failed: {e}; nostr crate version compatibility?\"));","preventionTips":["Pin and review the nostr crate version when tags fail to parse","Prefer typed Tag constructors over generic Tag::parse","Sanity-print tag values in test failures"],"tags":["rust","nostr","tag-parsing","test-code"],"backgroundTag":"nostr-tag-parse-failed","analyzedSha":"dad5a33865fc81a2e55b3b60746632f615ec1e3a","analyzedAt":"2026-08-30T13:49:18.474Z","contentChangedAt":"2026-08-30T13:49:18.474Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}