discordjs/discord.js · error · Error

Invalid pipeline constructed for string resource '${input}'

Error message

Invalid pipeline constructed for string resource '${input}'

What it means

createAudioResource() builds a transformer pipeline from the input stream type; if findPipeline returns an empty pipeline while inline volume was requested (no volume transform available), a string input cannot be used and the library throws. It signals that no valid transformer path exists for the given input type/volume constraint combination.

Source

Thrown at packages/voice/src/audio/AudioResource.ts:277

	input: Readable | string,
	options: CreateAudioResourceOptions<Metadata> = {},
): AudioResource<Metadata> {
	let inputType = options.inputType;
	let needsInlineVolume = Boolean(options.inlineVolume);

	// string inputs can only be used with FFmpeg
	if (typeof input === 'string') {
		inputType = StreamType.Arbitrary;
	} else if (inputType === undefined) {
		const analysis = inferStreamType(input);
		inputType = analysis.streamType;
		needsInlineVolume = needsInlineVolume && !analysis.hasVolume;
	}

	const transformerPipeline = findPipeline(inputType, needsInlineVolume ? VOLUME_CONSTRAINT : NO_CONSTRAINT);

	if (transformerPipeline.length === 0) {
		if (typeof input === 'string') throw new Error(`Invalid pipeline constructed for string resource '${input}'`);
		// No adjustments required
		return new AudioResource<Metadata>(
			[],
			[input],
			(options.metadata ?? null) as Metadata,
			options.silencePaddingFrames ?? 5,
		);
	}

	const streams = transformerPipeline.map((edge) => edge.transformer(input));
	if (typeof input !== 'string') streams.unshift(input);

	return new AudioResource<Metadata>(
		transformerPipeline,
		streams,
		(options.metadata ?? null) as Metadata,
		options.silencePaddingFrames ?? 5,
	);

View on GitHub (pinned to a81ed8a306)

Solutions

  1. Verify FFmpeg is installed and on PATH (ffmpeg -version)
  2. Pass options.inputType explicitly (e.g. StreamType.Arbitrary) so a valid pipeline is found
  3. Set inlineVolume: false if you don't need volume adjustment
  4. Ensure the string points to a real, supported media file/URL

Example fix

// before
const res = createAudioResource(url, { inlineVolume: true });
// after
const res = createAudioResource(url, { inputType: StreamType.Arbitrary, inlineVolume: false });
Defensive patterns

Strategy: validation

Validate before calling

import { execFileSync } from 'child_process';
const ffmpegOk = (() => { try { execFileSync('ffmpeg', ['-version'], { stdio: 'ignore' }); return true; } catch { return false; } })();
if (!ffmpegOk) throw new Error('FFmpeg required for this resource');
const res = createAudioResource(input, { inputType: StreamType.Arbitrary, inlineVolume: false });

Try / catch

try { res = createAudioResource(input, { inlineVolume: true }); } catch (e) { if (e.message.startsWith('Invalid pipeline')) res = createAudioResource(input, { inlineVolume: false }); else throw e; }

Prevention

When it happens

Trigger: Calling createAudioResource(path, { inlineVolume: true }) (or default when ffmpeg-volume analysis says no stream volume) where the transformer graph yields zero transformers for the input type — typically an unrecognized/unsupported input string or missing ffmpeg causing a fallback type with no volume node.

Common situations: Passing a URL or path with an unsupported extension/protocol; missing or broken FFmpeg install so stream analysis picks a type without a volume transformer; forcing an input type via options.inputType that lacks volume support while inlineVolume is requested.

Related errors


AI-assisted analysis of discordjs/discord.js@a81ed8a306 (2026-08-30). Data as JSON: /api/errors/5fbe69ca5133b8a3. Report an issue: GitHub.