{"record":{"id":"6e66e724e8a6e6c2","repo":"gchq/CyberChef","slug":"no-input-data-load-an-audio-file-drag-drop-or-us","errorCode":null,"errorMessage":"No input data. Load an audio file (drag/drop or use the open file button).","messagePattern":"No input data\\. Load an audio file \\(drag/drop or use the open file button\\)\\.","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/operations/ExtractAudioMetadata.mjs","lineNumber":50,"sourceCode":"        this.presentType = \"html\";\n\n        this.args = [\n            { name: \"Filename (optional)\", type: \"string\", value: \"\" },\n            { name: \"Max embedded text bytes (iXML/axml/etc)\", type: \"number\", value: 1024 * 512 },\n        ];\n    }\n\n    /**\n     * @param {ArrayBuffer} input\n     * @param {Object[]} args\n     * @returns {Object}\n     */\n    run(input, args) {\n        const filename = (args?.[0] || \"\").trim() || null;\n        const maxTextBytes = Number.isFinite(args?.[1]) ? Math.max(1024, args[1]) : 1024 * 512;\n\n        if (!(input instanceof ArrayBuffer) || input.byteLength === 0)\n            throw new OperationError(\"No input data. Load an audio file (drag/drop or use the open file button).\");\n\n        const bytes = new Uint8Array(input);\n        const container = sniffContainer(bytes);\n        const report = makeEmptyReport(filename, bytes.length, container);\n\n        try {\n            const parsers = {\n                mp3: () => parseMp3(bytes, report),\n                wav: () => parseRiffWave(bytes, report, maxTextBytes),\n                bw64: () => parseRiffWave(bytes, report, maxTextBytes),\n                flac: () => parseFlac(bytes, report, maxTextBytes),\n                ogg: () => parseOgg(bytes, report),\n                opus: () => parseOgg(bytes, report),\n                mp4: () => parseMp4BestEffort(bytes, report),\n                m4a: () => parseMp4BestEffort(bytes, report),\n                aiff: () => parseAiffBestEffort(bytes, report, maxTextBytes),\n                aac: () => parseAacAdts(bytes, report),\n                ac3: () => parseAc3(bytes, report),","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/ExtractAudioMetadata.mjs#L32-L68","documentation":"Thrown by the Extract Audio Metadata operation when the input is not an ArrayBuffer or is a zero-length ArrayBuffer. The operation expects raw audio file bytes (MP3, WAV, FLAC, OGG, etc.) to parse container and tag metadata. Without valid binary data there is nothing to sniff or parse.","triggerScenarios":"run(input, args) where input fails the check: !(input instanceof ArrayBuffer) || input.byteLength === 0. This happens when inputType is mismatched (e.g., string passed instead of ArrayBuffer) or when the file loaded is empty.","commonSituations":"User has not loaded a file into the input. Also occurs when an upstream operation in the recipe outputs a string or byteArray instead of an ArrayBuffer, or when an empty file is drag-dropped.","solutions":["Load an audio file via drag/drop or the open file button so input is a non-empty ArrayBuffer.","Ensure no upstream operation converts the data away from ArrayBuffer before this operation.","Verify the file is non-empty and is a supported audio format."],"exampleFix":"// before: input = '' (empty string) or input = new ArrayBuffer(0)\n\n// after: input = <audio file ArrayBuffer with byteLength > 0>","handlingStrategy":"type-guard","validationCode":"// Verify input is a non-empty ArrayBuffer before calling ExtractAudioMetadata\nif (!(input instanceof ArrayBuffer) || input.byteLength === 0) {\n  throw new Error('Load a non-empty audio file first');\n}","typeGuard":"function isValidAudioInput(input) {\n  return input instanceof ArrayBuffer && input.byteLength > 0;\n}","tryCatchPattern":null,"preventionTips":["Always load a file via the open file button or drag/drop before running.","Ensure upstream operations preserve ArrayBuffer type.","Verify file size is non-zero before processing."],"tags":["validation","audio","input-required","arraybuffer"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}