egametang/ET · error · Exception

GetChannelConn conn not found KChannel! {channelId}

Error message

GetChannelConn conn not found KChannel! {channelId}

What it means

KService.GetChannelConn looks up a KChannel by id and throws when none is found. The channel was either never created, already removed (disposed/errored), or the id is stale.

Source

Thrown at Packages/cn.etetet.core/Scripts/Core/Share/Network/KService.cs:117

            }
            
            base.Dispose();
            
            foreach (long channelId in this.localConnChannels.Keys.ToArray())
            {
                this.Remove(channelId);
            }

            this.Transport.Dispose();
            this.Transport = null;
        }

        public override (uint, uint) GetChannelConn(long channelId)
        {
            KChannel kChannel = this.Get(channelId);
            if (kChannel == null)
            {
                throw new Exception($"GetChannelConn conn not found KChannel! {channelId}");
            }
            return (kChannel.LocalConn, kChannel.RemoteConn);
        }
        
        public override void ChangeAddress(long channelId, IPEndPoint newIPEndPoint)
        {
            KChannel kChannel = this.Get(channelId);
            if (kChannel == null)
            {
                return;
            }
            kChannel.RemoteAddress = newIPEndPoint;
        }

        private void Recv()
        {
            if (this.Transport == null)
            {

View on GitHub (pinned to 5cab01f7a8)

Solutions

  1. Get the channel and null-check before querying conn ids (use Get which returns null).
  2. Clear id references when a channel is removed/disposed.
  3. Tolerate a missing channel at the call site instead of throwing.

Example fix

// before
(uint l, uint r) = kService.GetChannelConn(channelId);
// after
var ch = kService.Get(channelId);
if (ch == null) return;
(uint l, uint r) = (ch.LocalConn, ch.RemoteConn);
Defensive patterns

Strategy: validation

Validate before calling

var ch = kService.Get(channelId);
if (ch == null) { Log.Warning($"channel {channelId} gone"); return; }
(uint l, uint r) = (ch.LocalConn, ch.RemoteConn);

Type guard

public bool HasChannel(long id) => Get(id) != null;

Try / catch

null

Prevention

When it happens

Trigger: Querying a channel id after it was removed on disconnect/error, using an id from a previous service lifecycle, or a routing table pointing at a dead channel.

Common situations: Stale connection references held by a session manager, query racing with OnError cleanup, or wrong id passed.

Related errors


AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13). Data as JSON: /api/errors/84b486ba5d323a61. Report an issue: GitHub.