mudler/LocalAI · warning · Error

Normalized audio is larger than 50 MiB

Error message

Normalized audio is larger than 50 MiB

What it means

Thrown by normalizeAudioSample() after successful decode when the resampled WAV blob produced by audioBufferToWavBlob(decoded, REFERENCE_SAMPLE_RATE) exceeds MAX_AUDIO_BYTES (50 MiB). PCM WAV size is duration × sampleRate × channels × 2 bytes, so long or multi-channel audio decoded and resampled to the reference rate can blow past the cap.

Source

Thrown at core/http/react-ui/src/pages/VoiceProfileCreate.jsx:32

function base64ToArrayBuffer(value) {
  const binary = window.atob(value)
  const bytes = new Uint8Array(binary.length)
  for (let index = 0; index < binary.length; index += 1) bytes[index] = binary.charCodeAt(index)
  return bytes.buffer
}

async function normalizeAudioSample(sample) {
  const source = sample.blob?.arrayBuffer
    ? await sample.blob.arrayBuffer()
    : base64ToArrayBuffer(sample.base64)
  const AudioCtx = window.AudioContext || window.webkitAudioContext
  if (!AudioCtx) throw new Error('Web Audio API is not available in this browser')
  const context = new AudioCtx()
  try {
    const decoded = await context.decodeAudioData(source.slice(0))
    const blob = audioBufferToWavBlob(decoded, REFERENCE_SAMPLE_RATE)
    if (blob.size > MAX_AUDIO_BYTES) throw new Error('Normalized audio is larger than 50 MiB')
    return {
      ...sample,
      blob,
      dataUrl: URL.createObjectURL(blob),
      objectUrl: true,
      mime: 'audio/wav',
      duration: decoded.duration,
      sampleRate: REFERENCE_SAMPLE_RATE,
      name: sample.name || 'recording.wav',
    }
  } finally {
    await context.close().catch(() => {})
  }
}

function ReadinessItem({ ready, warning, children }) {
  const tone = ready ? 'ready' : warning ? 'warning' : 'pending'
  return (

View on GitHub (pinned to 44413a9d06)

Solutions

  1. Trim the sample to under 120 s (and ideally well under) before uploading
  2. Downmix to mono / standard rate in an external tool if the source is multi-channel
  3. Retry with a shorter, plain voice recording — the duration check would reject long audio anyway
Defensive patterns

Strategy: validation

Validate before calling

// Estimate decoded size before normalizing: PCM bytes ≈ duration × rate × channels × 2
function estimatedWavBytes(durationSeconds, channels = 1, rate = REFERENCE_SAMPLE_RATE) {
  return durationSeconds * rate * channels * 2 + 44 /* header */
}

Try / catch

try {
  const normalized = await normalizeAudioSample(sample)
} catch (err) {
  if (err.message.includes('larger than 50 MiB')) {
    setAudioError('Sample too large after conversion — trim it to under 2 minutes, mono')
    return
  }
  throw err
}

Prevention

When it happens

Trigger: Uploading a very long recording (the UI separately enforces 1–120 s after normalization, so this mostly fires for high-channel-count or high-rate sources before the duration check), or a decoded file whose channel layout expands after resampling (e.g. 5.1 surround decoded to many channels).

Common situations: User drags a long audio file (podcast excerpt) instead of a short voice sample; stereo/surround source decoded with channel expansion; sample already at a higher rate than REFERENCE_SAMPLE_RATE with long duration.

Related errors


AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15). Data as JSON: /api/errors/8d01c823842bd0cc. Report an issue: GitHub.