gchq/CyberChef · error · OperationError

No valid ID3 header.

Error message

No valid ID3 header.

What it means

Thrown by the Extract ID3 operation when the first three bytes of the input do not match the ID3 magic bytes 'ID3' (0x49, 0x44, 0x33). This indicates the input either has no ID3v2 tag, is not an MP3, or the tag is at a non-zero offset. Only files beginning with a valid ID3v2 header can be parsed.

Source

Thrown at src/core/operations/ExtractID3.mjs:46

        this.outputType = "JSON";
        this.presentType = "html";
        this.args = [];
    }

    /**
     * @param {ArrayBuffer} input
     * @param {Object[]} args
     * @returns {JSON}
     */
    run(input, args) {
        input = new Uint8Array(input);

        /**
         * Extracts the ID3 header fields.
         */
        function extractHeader() {
            if (!Array.from(input.slice(0, 3)).equals([0x49, 0x44, 0x33]))
                throw new OperationError("No valid ID3 header.");

            const header = {
                "Type": "ID3",
                // Tag version
                "Version": input[3].toString() + "." + input[4].toString(),
                // Header version
                "Flags": input[5].toString()
            };

            input = input.slice(6);
            return header;
        }

        /**
         * Converts the size fields to a single integer.
         *
         * @param {number} num
         * @returns {string}

View on GitHub (pinned to 4290ea7539)

Solutions

  1. Ensure the input is an MP3 file that begins with an ID3v2 tag.
  2. Use the Extract Audio Metadata operation instead for broader format support including ID3v1.
  3. Check that no upstream operation has stripped or offset the ID3 header.
  4. Verify the first bytes are literally 'ID3' in a hex viewer.

Example fix

// before: input = WAV file or MP3 with only ID3v1 -> first bytes != 'ID3'

// after: input = MP3 beginning with ID3v2 header (bytes: 49 44 53 ...)
Defensive patterns

Strategy: type-guard

Validate before calling

// Verify first 3 bytes are 'ID3' magic before calling ExtractID3
const bytes = new Uint8Array(input);
if (bytes.length < 3 || bytes[0] !== 0x49 || bytes[1] !== 0x44 || bytes[2] !== 0x33) {
  throw new Error('Input does not start with an ID3v2 header');
}

Type guard

function hasID3v2Header(input) {
  const bytes = new Uint8Array(input);
  return bytes.length >= 3 && bytes[0] === 0x49 && bytes[1] === 0x44 && bytes[2] === 0x33;
}

Prevention

When it happens

Trigger: run(input, args) where Array.from(input.slice(0,3)).equals([0x49,0x44,0x33]) returns false. The input is converted to Uint8Array at line 39 and the header check runs in extractHeader() at line 45.

Common situations: Feeding an MP3 that only has ID3v1 tags (at end of file), an MP3 with no tags, a WAV/FLAC file, or any non-MP3 binary. Also occurs when the ID3v2 tag is not at the very start of the file.

Related errors


AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13). Data as JSON: /api/errors/f368c177fc7d1927. Report an issue: GitHub.