{"record":{"id":"9e0220e7f5135ee8","repo":"discordjs/discord.js","slug":"no-session-available","errorCode":null,"errorMessage":"No session available","messagePattern":"No session available","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/voice/src/networking/DAVESession.ts","lineNumber":183,"sourceCode":"\t\t\t\tthis.session = new Davey.DAVESession(this.protocolVersion, this.userId, this.channelId);\n\t\t\t\tthis.emit('debug', `Session initialized for protocol version ${this.protocolVersion}`);\n\t\t\t}\n\n\t\t\tthis.emit('keyPackage', this.session!.getSerializedKeyPackage());\n\t\t} else if (this.session) {\n\t\t\tthis.session.reset();\n\t\t\tthis.session.setPassthroughMode(true, TRANSITION_EXPIRY);\n\t\t\tthis.emit('debug', 'Session reset');\n\t\t}\n\t}\n\n\t/**\n\t * Set the external sender for this session.\n\t *\n\t * @param externalSender - The external sender\n\t */\n\tpublic setExternalSender(externalSender: Buffer) {\n\t\tif (!this.session) throw new Error('No session available');\n\t\tthis.session.setExternalSender(externalSender);\n\t\tthis.emit('debug', 'Set MLS external sender');\n\t}\n\n\t/**\n\t * Prepare for a transition.\n\t *\n\t * @param data - The transition data\n\t * @returns Whether we should signal to the voice server that we are ready\n\t */\n\tpublic prepareTransition(data: VoiceDavePrepareTransitionData) {\n\t\tthis.emit('debug', `Preparing for transition (${data.transition_id}, v${data.protocol_version})`);\n\t\tthis.pendingTransitions.set(data.transition_id, data.protocol_version);\n\n\t\t// When the included transition id is 0, the transition is for (re)initialization and it can be executed immediately.\n\t\tif (data.transition_id === 0) {\n\t\t\tthis.executeTransition(data.transition_id);\n\t\t} else {","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/discordjs/discord.js/blob/a81ed8a306d37fdc746e26a634b6a42164ba2c8c/packages/voice/src/networking/DAVESession.ts#L165-L201","documentation":"setExternalSender() requires an active underlying MLS session; when this.session is null (not yet initialized), it throws 'No session available'. The MLS external sender payload can only be applied to an initialized session.","triggerScenarios":"Calling setExternalSender(buffer) (directly or via the binary websocket handler onWsBinary) before the DAVE session has finished initializing, or after it was destroyed.","commonSituations":"Voice gateway delivers the MLS external sender payload before session setup completes; session init failed due to a missing/incompatible @snazzah/davey install; race between gateway messages and session readiness.","solutions":["Ensure the session is initialized/ready before handling the external sender message","Buffer the external sender payload and apply it on session ready","Install/repair the @snazzah/davey dependency so initialization succeeds","Reinitialize the DAVE session and re-send the external sender"],"exampleFix":"// before\nsession.setExternalSender(payload);\n// after\nif (session.isReady()) session.setExternalSender(payload);\nelse pendingExternalSender = payload; // apply once ready","handlingStrategy":"try-catch","validationCode":"function canSetSender(s) { return (s as any).session != null; }\nif (canSetSender(dave)) dave.setExternalSender(payload); else pendingSender = payload;","typeGuard":"function hasActiveSession(s: { session?: unknown }): boolean { return s.session != null; }","tryCatchPattern":"try { dave.setExternalSender(buf); } catch (e) { if (e.message === 'No session available') pendingSender = buf; else throw e; }","preventionTips":["Queue binary payloads (external sender) until session ready","Listen for session init/ready events from DAVESession","Keep @snazzah/davey installed at the supported version","Re-apply external sender after each reinit if required"],"tags":["voice","mls","dave","lifecycle"],"backgroundTag":"session-not-initialized","analyzedSha":"a81ed8a306d37fdc746e26a634b6a42164ba2c8c","analyzedAt":"2026-08-30T04:07:22.193Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}