remotion-dev/remotion · error · Error

Value is null

Error message

Value is null

What it means

Thrown by `parseStreamInf` while parsing the attributes of an HLS `#EXT-X-STREAM-INF` directive. Each comma-separated attribute must contain an `=` sign (key=value). When `splitRespectingQuotes` produces a token with no `=` (i.e., `firstColon === -1`), the value is `null` and the parser refuses to proceed.

Source

Thrown at packages/media-parser/src/containers/m3u/parse-stream-inf.ts:42

	// Push the last token, if any.
	if (currentPart) {
		result.push(currentPart);
	}

	return result;
}

export const parseStreamInf = (str: string): M3uStreamInfo => {
	const quotes = splitRespectingQuotes(str);
	const map: Record<string, string> = {};
	for (const quote of quotes) {
		const firstColon = quote.indexOf('=');
		const key =
			firstColon === -1 ? quote : (quote.slice(0, firstColon) as string);
		const value = firstColon === -1 ? null : quote.slice(firstColon + 1);
		if (value === null) {
			throw new Error('Value is null');
		}

		const actualValue =
			value?.startsWith('"') && value?.endsWith('"')
				? value.slice(1, -1)
				: value;

		map[key] = actualValue;
	}

	return {
		type: 'm3u-stream-info',
		averageBandwidthInBitsPerSec: map['AVERAGE-BANDWIDTH']
			? parseInt(map['AVERAGE-BANDWIDTH'], 10)
			: null,
		bandwidthInBitsPerSec: map.BANDWIDTH ? parseInt(map.BANDWIDTH, 10) : null,
		codecs: map.CODECS ? map.CODECS.split(',') : null,
		dimensions: map.RESOLUTION

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Inspect the `#EXT-X-STREAM-INF` line in the manifest and ensure every attribute follows `KEY=VALUE` format.
  2. If the manifest is served by a third party, report the malformed directive or proxy/fix the manifest before parsing.
  3. Validate the manifest against the HLS specification (RFC 8216) before passing it to `parseMedia`.
  4. Use a manifest validation tool or HLS conformance checker to catch syntax errors upstream.

Example fix

// before (malformed manifest line)
#EXT-X-STREAM-INF:BANDWIDTH=1280000,RESOLUTION

// after
#EXT-X-STREAM-INF:BANDWIDTH=1280000,RESOLUTION=1280x720
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-validate an HLS manifest before parsing
function validateStreamInf(manifestText: string): void {
  const lines = manifestText.split('\n');
  for (const line of lines) {
    if (line.startsWith('#EXT-X-STREAM-INF:')) {
      const attrs = line.slice('#EXT-X-STREAM-INF:'.length);
      const parts = attrs.split(',');
      for (const part of parts) {
        if (!part.includes('=') && !part.startsWith('"')) {
          throw new Error(`Malformed STREAM-INF attribute: "${part}" (missing '=')`);
        }
      }
    }
  }
}

Try / catch

try {
  await parseMedia({src: 'https://example.com/master.m3u8'});
} catch (e) {
  if (e instanceof Error && e.message === 'Value is null') {
    console.error('The HLS manifest has a malformed #EXT-X-STREAM-INF directive.');
    // Inspect and fix the manifest source
  }
  throw e;
}

Prevention

When it happens

Trigger: Parsing an HLS master playlist whose `#EXT-X-STREAM-INF` line contains a bare attribute token without an `=` sign — e.g., `#EXT-X-STREAM-INF:BANDWIDTH=1280000,UNQUOTED` where `UNQUOTED` has no value, or a manifest that uses non-standard attribute syntax.

Common situations: Hand-edited or dynamically generated M3U8 manifests with typos in stream-inf attributes. Third-party CDN manifests with non-conformant attribute formatting. Manifests produced by tools that emit attribute flags without values.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/e6eab18129721b02. Report an issue: GitHub.