Skip to main content
Version: v2.10.5 (current)

Migrating to 2.10.5

From 2.10.4 or 2.10.3​

Versions 2.10.3 and 2.10.4 are deprecated because incorrect player connection states during startup, restores, or channel moves may prevent subsequent saves. Upgrade to stable 2.10.5, not the completed 2.10.5-alpha.1 test build. That candidate was tested successfully with a real bot before stable preparation, but does not establish a full backend/version matrix. No API signature, dependency, save policy, or storage configuration changes are required for this patch.

npm install [email protected]

socketClosed continues to emit the same event and payload, but no longer sets player.state to DISCONNECTED. A 4006 closure of an old socket during a restart/restore or a late 4014 after a channel move may arrive after updated voice credentials and resumed audio. Do not treat that event alone as proof of a current disconnect or force a state assignment in your event listener.

Discord voice leave (channel_id: null), explicit disconnect() / destroy(), and native NodeLink lifecycle events still handle actual state changes. The 2.10.4 fix remains: heartbeat message.state.connected is a raw transport observation, not the authority for player.state.

Correct lifecycle state prevents savePlayerState() from skipping an active restored or moved player; the save policy itself is unchanged. Debug payload serialization now has a listener guard around the pre-existing log.

Run the release validation checklist, including startup, restart/restore 4006, late channel-move 4014 after audio resumes, normal shutdown and a second restart, plus explicit kick/disconnect. The 62 automated cases use mocked gateway and persistence paths for both backend protocols; they do not replace testing your actual deployment.

For older upgrades, retain the 2.10.3 type/playlist migration below. The archived 2.10.4 guide and sections below document historical releases, not the current socket-closure behavior.

Migrating to 2.10.4 (Historical)

Historical Socket Behavior

This section describes 2.10.4. Its socket-closure guidance is not current: 2.10.5 no longer sets DISCONNECTED from socketClosed alone. Upgrade using the 2.10.5 section above; 2.10.4 is deprecated.

From 2.10.3​

2.10.4 fixes the periodic player-state regression without changing public signatures, runtime dependencies, or storage configuration.

npm install [email protected]

player.state is the library lifecycle state. A periodic playerUpdate still updates position and emits the unchanged payload, but does not overwrite that lifecycle state from the server's voice-transport flag.

If your bot needs the server's connection observation, read the payload directly:

import { ManagerEventTypes } from "magmastream";

manager.on(ManagerEventTypes.PlayerUpdate, (eventPlayer, message) => {
console.log(eventPlayer.guildId, message.state.connected);
});

Do not add an arbitrary delay to trackStart or assign CONNECTED in your bot to hide this regression. The callback retains the lifecycle state; actual voice readiness is a separate observation. Explicit disconnects and native NodeLink reconnect/connect/destroy events remain authoritative. Following voice socket closure, use the normal connection flow or the native lifecycle event to restore state; a later telemetry packet alone does not reconnect the player.

Run your bot's tests and the release validation checklist, especially first-track startup, voice leave, and reconnection. The library's npm test suite is also included in npm run ci.

From 2.10.2 or Earlier​

Apply the 2.10.3 migration below as well, or consult the archived 2.10.3 guide. Its public type and playlist corrections still apply in 2.10.4.

Migrating to 2.10.3 (Historical)

This guide covers the stable 2.10.2 to 2.10.3 upgrade. Existing Lavalink v4 applications do not need a second Node class or a new storage configuration. They do need to account for the corrected public types and playlist shape.

Install and Retain a Rollback​

npm install [email protected]

Review and retain your dependency lockfile. Reverting to [email protected] also requires reverting code that uses native NodeLink methods or corrected 2.10.3-specific shapes. Do not publish or upgrade a production bot solely because the package builds.

Playlist Metadata​

Previously, playlistInfo was typed/filled as plugin metadata. It now contains the actual Lavalink playlist information. Move plugin-field reads to pluginInfo.

if ("playlist" in result) {
const { playlist } = result;

// Core protocol information:
console.log(playlist.playlistInfo.name);
console.log(playlist.playlistInfo.selectedTrack);

// Extensible plugin metadata, validated before use:
const url = playlist.pluginInfo.url;
if (typeof url === "string") {
console.log(url);
}
}

PlaylistInfoData is a single { name, selectedTrack } object, not an array. A selected index of -1 means no selected track.

Nullable Track Fields​

Track URI, artwork URL, and ISRC can be null, even though modern providers usually set a URI. Keep that protocol contract in application code.

if (track.uri) {
embed.setURL(track.uri);
}
if (track.artworkUrl) {
embed.setThumbnail(track.artworkUrl);
}
const isYouTube = track.uri?.includes("youtube.com") ?? false;

Do not cast away nullability or substitute undefined in the library's protocol types. Choose application-specific fallbacks when rendering a missing URL. Raw TrackData.userData is exposed on built tracks as Track.customData.

Search Results and Gateway Messages​

Narrow SearchResult by loadType or property checks. Empty/backend-error load results contain tracks: []; transport failures still reject.

if (result.loadType === "empty" || result.loadType === "error") {
return;
}
await player.queue.add(result.tracks);

Gateway data is now a discriminated union rather than a stats-shaped message. Read stats only on op: "stats", player state only on op: "playerUpdate", and event-specific properties only after narrowing the event.

Remote LavaPlayer.track and NodeStats.frameStats may be null. Lyrics, chapter, and SponsorBlock callback tracks may also be null.

Separate Native Search APIs​

Continue using SearchPlatform for shared searches. Use NodeLinkSearchPlatform, NodeLinkRecommendationPlatform, and NodeLinkSearchType for native capabilities. Shared string values still permit either backend; native prefixes/modifiers require a connected eligible NodeLink.

NodeLink Spotify recommendations use sprec:seed_tracks=.... Lavalink's raw sprec:mix:track:... workaround stays on Lavalink. See search examples.

Guard Native Actions in Mixed Pools​

if (player.node.isNodeLink) {
await player.setNodeLinkLoudnessNormalizer(true);
const chapters = await player.getNodeLinkChapters();
}

Pin native-feature players with nodeIdentifier when creating them. Recheck after node moves. Do not assume a native search also pins playback.

Mixer layers use 0-1 volume, not the main player's 0-1000 scale. preloadNextTrack() does not enqueue a track; keep the local next track aligned. Use explicit NodeLink aliases to make native-only code apparent.

Plugin Filters and Lyrics​

Nonempty setPluginFilters() now checks for a matching advertised plugin. By default it expects LavaDSPX-Plugin aliases; provide the advertised plugin name for another plugin. Empty calls clear without that requirement.

On NodeLink, use node.getLyrics(track, false, language) and narrow NodeLinkGetLyrics. The current player.getCurrentLyrics() return type does not reflect its unnormalized native runtime result. See lyrics handling.

Sessions and Restores​

Wait for node readiness before calling session-scoped REST helpers. getPlayers() returns an empty array without a session; some other helpers currently return null at runtime despite their declared signatures.

Autoplay settings and requester data are now preserved through state restoration. Check the first restored autoplay request and wrapper-specific user resolution when testing JSON or Redis state. No new storage setup is required.

Validate the Upgrade​

Run your bot's typecheck/tests and the release validation checklist on Lavalink, NodeLink, and a mixed pool before promotion.


Older Migration Guide

🔥 Upgrading to MagmaStream v2.10.0 — Migration Guide​

warning

This release contains breaking changes. Review everything below before upgrading.
Lables:
🔴 - Breaking
🟡 - Changes
🟢 - New


🔴 Renamed Options​

PlayerOptions:

  • guild → guildId
  • voiceChannel → voiceChannelId
  • textChannel → textChannelId
  • node → nodeIdentifier

NodeOptions:

  • secure → useSSL
  • resumeStatus → enableSessionResumeOption
  • resumeTimeout → sessionTimeoutSeconds
  • retryAmount → maxRetryAttempts
  • retryDelay → retryDelayMs
  • priority → nodePriority

ManagerOptions:

  • autoPlay → playNextOnEnd
  • usePriority → enablePriorityMode
  • replaceYouTubeCredentials → normalizeYouTubeTitles
  • plugins → enabledPlugins

🔴 Queue Overhaul​

The old Queue class has been removed. You must now pick a storage backend explicitly:

  • MemoryQueue — in-memory, synchronous methods (closest to old behaviour)
  • JsonQueue — persists to disk, async methods
  • RedisQueue — persists to Redis, async methods
warning

If you use JsonQueue or RedisQueue, all queue calls need await.


🔴 Filter API​

Filters now take an explicit boolean instead of being toggle calls:

Before

player.filters.nightcore()

After

player.filters.nightcore(true)
player.filters.nightcore(false)

bassBoost now takes a stage from -3 to 3 instead of being a toggle: player.filters.bassBoost(3) = max boost, player.filters.bassBoost(0) = disabled


🟡 Error Handling​

All errors are now MagmaStreamError instances with structured codes and context. Replace any TypeError / RangeError catches with MagmaStreamError.


🟢 What's been added​

  • Library wrappers: DiscordJSManager, DiscordenoManager, ErisManager, OceanicManager, SeyfertManager
  • Abstract Plugin base class with load() / unload() methods
  • Redis-backed session and queue storage
  • New filters: demon, earrape, doubletime, chipmunk, daycore, darthvader, electronic, radio, tremolo, pop, party

Questions?​

  • 📄 Full docs here
  • ❔ Join our Discord — we're happy to help.