Skip to content

fix: group visibility toggle fails with NDKPublishError #202

@dmnyc

Description

@dmnyc

Problem

Toggling a group between public and members-only via the kebab menu fails with:

NDKPublishError: Not enough relays received the event
    at async publishWithAuthRetry (nip29.ts:655:3)
    at async editGroupMetadata (nip29.ts:843:2)
    at async handleToggleVisibility (GroupList.svelte:242:61)

The Pantry relay (wss://pantry.zap.cooking) rejects the kind 9002 edit-metadata event when visibility tags are included.

Root Cause

In src/lib/nip29.ts:832-838, editGroupMetadata sends visibility tags that may not match what the Pantry relay expects:

if (fields.visibility === 'public') {
    event.tags.push(['public']);
    event.tags.push(['unrestricted']);
} else if (fields.visibility === 'members-only') {
    event.tags.push(['private']);
    event.tags.push(['restricted']);
}

Per NIP-29, kind 9002 (edit-metadata) lists unrestricted, open, visible, public as valid optional tags. The private and restricted tags are used in the kind 39000 metadata event (relay-generated), not in the user-sent edit event.

The relay likely rejects ['private'] and ['restricted'] as unrecognized tags on a kind 9002 event.

Suggested Fix

  1. Confirm with the Pantry relay operator what tags kind 9002 actually accepts for toggling visibility. The NIP-29 spec is ambiguous about how to remove public/unrestricted status — it only lists the positive-form tags.

  2. If the relay supports toggling via presence/absence of positive tags, update editGroupMetadata to:

    • For "make public": include ['public'] and ['unrestricted'] tags
    • For "make members-only": do NOT include ['private']/['restricted'] — instead, the relay may expect an edit-metadata event without the public/unrestricted tags to implicitly remove them
  3. If the relay needs a separate mechanism, it may require a different approach entirely (e.g., a dedicated moderation event kind).

  4. Add user-facing error feedback — currently the error is silently caught in GroupList.svelte:255-256. Consider showing a toast or inline error when the toggle fails.

Files

  • src/lib/nip29.ts:814-846editGroupMetadata function
  • src/lib/components/groups/GroupList.svelte:235-259handleToggleVisibility function

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions