SnapDrop/snapdrop · error

ICE Gathering failed

Error message

ICE Gathering failed

What it means

Fires in _onIceConnectionStateChange when this._conn.iceConnectionState becomes 'failed': the WebRTC ICE agent found no usable candidate path (host, srflx, or relay) between the peers, so NAT/firewall traversal for this connection failed. Despite the wording, it signals overall ICE connectivity failure, not just gathering.

Source

Thrown at client/scripts/network.js:325

    }

    _onConnectionStateChange(e) {
        console.log('RTC: state changed:', this._conn.connectionState);
        switch (this._conn.connectionState) {
            case 'disconnected':
                this._onChannelClosed();
                break;
            case 'failed':
                this._conn = null;
                this._onChannelClosed();
                break;
        }
    }

    _onIceConnectionStateChange() {
        switch (this._conn.iceConnectionState) {
            case 'failed':
                console.error('ICE Gathering failed');
                break;
            default:
                console.log('ICE Gathering', this._conn.iceConnectionState);
        }
    }

    _onError(error) {
        console.error(error);
    }

    _send(message) {
        if (!this._channel) return this.refresh();
        this._channel.send(message);
    }

    _sendSignal(signal) {
        signal.type = 'signal';
        signal.to = this._peerId;

View on GitHub (pinned to b8b78cc22a)

Solutions

  1. Verify a STUN server (e.g. stun.l.google.com:19302) is configured in the RTCPeerConnection iceServers
  2. Add a TURN server with credentials so candidates can be relayed when direct traversal fails
  3. Check that neither side blocks UDP egress or TURN ports (3478/5349)
  4. Call conn.restartIce() on 'failed' to retry with fresh candidates instead of only logging
  5. Invoke this._onChannelClosed() on failure so the UI can prompt a reconnect
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at client/scripts/network.js:325 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of SnapDrop/snapdrop@b8b78cc22a (2026-09-02). Data as JSON: /api/errors/160629a4321b09c3. Report an issue: GitHub.