{"record":{"id":"df862e1c084b67c0","repo":"block/buzz","slug":"relay-owner-pubkey-required-when-buzz-require-rela","errorCode":null,"errorMessage":"RELAY_OWNER_PUBKEY required when BUZZ_REQUIRE_RELAY_MEMBERSHIP=true","messagePattern":"RELAY_OWNER_PUBKEY required when BUZZ_REQUIRE_RELAY_MEMBERSHIP=true","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"critical","filePath":"crates/buzz-relay/src/main.rs","lineNumber":324,"sourceCode":"        Ok(false) => {}\n        Err(e) => {\n            error!(\n                \"Replica fence disabled — floor guard verification failed: {e}. \\\n                 All cursor reads stay on the writer.\"\n            );\n        }\n    }\n\n    // NIP-43: if membership enforcement is on, a valid owner pubkey is required.\n    // config.rs already strips invalid values with a warning; catch the resulting\n    // None here so we fail fast with a clear message rather than starting a relay\n    // that no one can administer.\n    if config.require_relay_membership && config.relay_owner_pubkey.is_none() {\n        error!(\n            \"BUZZ_REQUIRE_RELAY_MEMBERSHIP=true but RELAY_OWNER_PUBKEY is not set or invalid. \\\n             Set RELAY_OWNER_PUBKEY to a valid 64-char hex pubkey.\"\n        );\n        return Err(anyhow::anyhow!(\n            \"RELAY_OWNER_PUBKEY required when BUZZ_REQUIRE_RELAY_MEMBERSHIP=true\"\n        ));\n    }\n\n    // NIP-43: relay membership requires a stable signing key.\n    // Check this before any DB mutations so we fail fast — no point backfilling\n    // or bootstrapping if we'll reject the config anyway.\n    if config.require_relay_membership && config.relay_private_key.is_none() {\n        return Err(anyhow::anyhow!(\n            \"BUZZ_RELAY_PRIVATE_KEY is required when BUZZ_REQUIRE_RELAY_MEMBERSHIP=true. \\\n             NIP-43 events signed with an ephemeral key become unverifiable after restart.\"\n        ));\n    }\n\n    // NIP-43 / multi-tenant: seed the deployment's *own* community before any\n    // membership backfill or owner bootstrap, so those writes are scoped to a\n    // real `(community_id, pubkey)` and not a global pubkey. The host is derived\n    // from `relay_url` with the *same* normalization request resolution uses","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/block/buzz/blob/ef2aa1ae38fadcc0bc22b8bf6ed96b35933146be/crates/buzz-relay/src/main.rs#L306-L342","documentation":"Fatal startup error: BUZZ_REQUIRE_RELAY_MEMBERSHIP=true (NIP-43 enforcement) but no usable owner pubkey exists. config.rs silently strips an invalid RELAY_OWNER_PUBKEY (anything that is not 64-char hex) to None, and main() fails fast because a membership-enforcing relay without an owner can never be administered.","triggerScenarios":"Starting the relay with BUZZ_REQUIRE_RELAY_MEMBERSHIP=true while RELAY_OWNER_PUBKEY is unset, empty, contains a 0x prefix, whitespace, an npub… string, or is not exactly 64 hex characters.","commonSituations":"Copy-pasting an npub or a pubkey with 0x prefix from a wallet UI; CI/secret manager delivering an empty value; enabling membership enforcement on an existing deployment without adding the owner var.","solutions":["Set RELAY_OWNER_PUBKEY to the 64-char hex pubkey of the admin (no 0x, no npub, no whitespace)","Verify length and charset before deploy: echo -n \"$RELAY_OWNER_PUBKEY\" | wc -c should be 64 and match ^[0-9a-fA-F]{64}$","For local dev where you do not want enforcement, set BUZZ_REQUIRE_RELAY_MEMBERSHIP=false instead"],"exampleFix":"# before\nexport BUZZ_REQUIRE_RELAY_MEMBERSHIP=true\nexport RELAY_OWNER_PUBKEY=npub1abc...\n\n# after\nexport BUZZ_REQUIRE_RELAY_MEMBERSHIP=true\nexport RELAY_OWNER_PUBKEY=953d1d0e0c4b7a5f6e2d8c9a1b3f5e7d9c0a2b4f6e8d0c2a4b6f8e0d2c4a6b8f","handlingStrategy":"validation","validationCode":"# Deploy-time guard:\n: \"${RELAY_OWNER_PUBKEY:?RELAY_OWNER_PUBKEY required}\"\n[[ \"$RELAY_OWNER_PUBKEY\" =~ ^[0-9a-fA-F]{64}$ ]] || { echo 'RELAY_OWNER_PUBKEY must be 64-char hex'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate 64-hex format in CI before the secret reaches the relay","Convert npub keys to hex — the relay only accepts raw hex","When enabling BUZZ_REQUIRE_RELAY_MEMBERSHIP, add both owner pubkey and relay private key in the same change"],"tags":["config","environment","nip-43","startup","buzz-relay"],"backgroundTag":"missing-env-var","analyzedSha":"ef2aa1ae38fadcc0bc22b8bf6ed96b35933146be","analyzedAt":"2026-08-20T04:38:24.874Z","contentChangedAt":"2026-08-20T04:38:24.874Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}