discordjs/discord.js · error · Error
Node type '${type}' does not exist!
Error message
Node type '${type}' does not exist! What it means
getNode() looks up a node in the transformer graph by StreamType; throwing when the key is absent. This is an internal invariant guard used by findPath/findPipeline, surfacing when an unknown stream type string is supplied.
Source
Thrown at packages/voice/src/audio/TransformerGraph.ts:113
*
* @param edge - The edge to create
*/
public addEdge(edge: Omit<Edge, 'from'>) {
this.edges.push({ ...edge, from: this });
}
}
// Create a node for each stream type
let NODES: Map<StreamType, Node> | null = null;
/**
* Gets a node from its stream type.
*
* @param type - The stream type of the target node
*/
export function getNode(type: StreamType) {
const node = (NODES ??= initializeNodes()).get(type);
if (!node) throw new Error(`Node type '${type}' does not exist!`);
return node;
}
// Try to enable FFmpeg Ogg optimizations
function canEnableFFmpegOptimizations(): boolean {
try {
return prism.FFmpeg.getInfo().output.includes('--enable-libopus');
} catch {}
return false;
}
function initializeNodes(): Map<StreamType, Node> {
const nodes = new Map<StreamType, Node>();
for (const streamType of Object.values(StreamType)) {
nodes.set(streamType, new Node(streamType));
}
View on GitHub (pinned to a81ed8a306)
Solutions
- Use the exported StreamType enum instead of raw strings
- Check the StreamType enum in your installed @discordjs/voice version for the exact key
- Update @discordjs/voice to the latest version
- Only call getNode/findPipeline with enum members
Example fix
// before
createAudioResource(file, { inputType: 'webm/opus' as any });
// after
import { StreamType } from '@discordjs/voice';
createAudioResource(file, { inputType: StreamType.WebmOpus }); Defensive patterns
Strategy: validation
Validate before calling
import { StreamType } from '@discordjs/voice';
function isValidStreamType(t) { return Object.values(StreamType).includes(t); }
if (!isValidStreamType(opts.inputType)) throw new TypeError('unknown inputType'); Type guard
function isStreamType(v: string): v is StreamType { return Object.values(StreamType).includes(v as StreamType); } Try / catch
try { res = createAudioResource(input, { inputType }); } catch (e) { if (e.message.includes('does not exist')) res = createAudioResource(input); else throw e; } Prevention
- Always use the StreamType enum, never raw strings
- Check enum members against your installed @discordjs/voice version
- Avoid calling internal getNode/findPipeline directly
- Pin and update the library version consistently
When it happens
Trigger: Passing an invalid/unknown StreamType value (typo, wrong string) to createAudioResource via options.inputType, or programmatically calling getNode with a non-existent StreamType enum member.
Common situations: Typo in inputType string like 'ogg/opus' vs 'ogg/opus' variants; upgrading @discordjs/voice where StreamType members changed; hand-rolling a custom pipeline against getNode.
Related errors
- BitFieldInvalid: ${JSON.stringify(bit)}
- Cannot play a resource that has already ended.
- Resource is already being played by another audio player.
- Invalid pipeline constructed for string resource '${input}'
- Cannot play audio as no valid encryption package is installe
AI-assisted analysis of discordjs/discord.js@a81ed8a306 (2026-08-30).
Data as JSON: /api/errors/0ff0263f77fec7c7.
Report an issue: GitHub.