{"record":{"id":"ccdbe8480ca6b407","repo":"Zackriya-Solutions/meetily","slug":"file-too-large-2-gb-maximum-supported-size-is","errorCode":null,"errorMessage":"File too large: {:.2}GB. Maximum supported size is {}GB","messagePattern":"File too large: (.+?)GB\\. Maximum supported size is (.+?)GB","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"frontend/src-tauri/src/audio/import.rs","lineNumber":149,"sourceCode":"        .map(|e| e.to_lowercase())\n        .unwrap_or_default();\n\n    if !AUDIO_EXTENSIONS.contains(&extension.as_str()) {\n        return Err(anyhow!(\n            \"Unsupported format: .{}. Supported: {}\",\n            extension,\n            AUDIO_EXTENSIONS.join(\", \")\n        ));\n    }\n\n    // Get file size\n    let metadata = std::fs::metadata(path)\n        .map_err(|e| anyhow!(\"Cannot read file: {}\", e))?;\n    let size_bytes = metadata.len();\n\n    // Check file size limit\n    if size_bytes > MAX_FILE_SIZE_BYTES {\n        return Err(anyhow!(\n            \"File too large: {:.2}GB. Maximum supported size is {}GB\",\n            size_bytes as f64 / (1024.0 * 1024.0 * 1024.0),\n            MAX_FILE_SIZE_BYTES / (1024 * 1024 * 1024)\n        ));\n    }\n\n    // Get filename without extension for title\n    let filename = path\n        .file_stem()\n        .and_then(|s| s.to_str())\n        .unwrap_or(\"Imported Audio\")\n        .to_string();\n\n    // Try fast metadata-only validation first\n    let duration_seconds = match extract_duration_from_metadata(path) {\n        Ok(duration) => {\n            debug!(\n                \"Got duration from metadata: {:.2}s (fast path)\",","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/audio/import.rs#L131-L167","documentation":"validate_audio_file (import.rs:149) rejects files whose metadata len() exceeds MAX_FILE_SIZE_BYTES, a 20 GiB cap defined at import.rs:61 explicitly to prevent OOM during the decode-to-memory pipeline (all samples accumulate into a Vec<f32>, multiplying size several-fold over the compressed input) and to bound processing time. It fires after existence/format checks and before duration probing. The cap is on total file size, not audio payload, so video-heavy MP4s hit it even though their audio track is small.","triggerScenarios":"Selecting multi-hour lossless captures (24h WAV at 48kHz stereo is ~15.5 GiB uncompressed - borderline); huge video files whose audio is tiny but whose container exceeds 20 GiB (4K screen recordings, multi-hour seminar MP4s); concatenated archives; PMR/recovery recordings.","commonSituations":"Importing day-long conference recordings or screen captures; WAV masters from studio sessions; users assuming audio import counts only the audio stream; surveillance/lecture capture archives.","solutions":["Extract just the audio: ffmpeg -i huge.mp4 -vn -c:a aac -b:a 64k audio.m4a - usually shrinks 20+ GiB video to a few hundred MB.","Split long recordings into parts under 20 GiB (ffmpeg -i in.wav -f segment -segment_time 3600 part%02d.wav) and import sequentially.","Downsample while extracting (-ac 1 -ar 16000) to match the Whisper pipeline target and cut resample memory too.","If >20 GiB single-file import is truly needed, raise MAX_FILE_SIZE_BYTES in import.rs - but first verify RAM headroom for the in-memory f32 samples.","Prevent at the UI: show the size limit next to the picker so users transcode before selecting."],"exampleFix":"# before: 25GB mp4 rejected by the 20GiB cap\n# after: strip video, keep speech-quality audio - imports fine\nffmpeg -i meeting-4k.mp4 -vn -ac 1 -ar 16000 -c:a aac -b:a 48k meeting-audio.m4a","handlingStrategy":"validation","validationCode":"// Frontend: pre-check size before invoking so users get guidance, not an error\nconst MAX = 20 * 1024 * 1024 * 1024;\nconst stat = await statFile(path); // via fs plugin\nif (stat.size > MAX) suggestAudioExtraction(path);","typeGuard":"const withinImportLimit = (sizeBytes: number) => sizeBytes <= 20 * 1024 * 1024 * 1024;","tryCatchPattern":"try { await invoke('import_audio_file', payload); }\ncatch (e) {\n  if (String(e).startsWith('File too large'))\n    showHint('Run: ffmpeg -i file.mp4 -vn -ac 1 -ar 16000 -c:a aac out.m4a and import out.m4a');\n  else throw e;\n}","preventionTips":["Show the 20GB limit next to the file picker.","Extract audio (-vn) from big video containers before importing - usually a 100x shrink.","Split multi-day recordings into per-session files.","If raising MAX_FILE_SIZE_BYTES, size RAM for all f32 samples held in memory (~4 bytes/sample)."],"tags":["file","import","file-size","limit","memory-safety","validation"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}