mudler/LocalAI · warning · Error

voiceCreate.audio.durationError

Error message

voiceCreate.audio.durationError

What it means

Thrown by handleAudio() when the normalized sample's duration falls outside [1, 120] seconds. The message is the i18n key 'voiceCreate.audio.durationError' itself (t() lookup), so the user sees the localized string while the error string stored in audioError is the key. The objectUrl created during normalization is revoked before throwing to avoid leaking the blob.

Source

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

    quality: !!audio && durationRecommended,
    name: !!name.trim(),
    transcript: !!transcript.trim(),
    consent,
  }), [audio, durationValid, durationRecommended, name, transcript, consent])

  const handleAudio = async (sample) => {
    if (!sample) {
      setAudio(null)
      setAudioError('')
      return
    }
    setAudioProcessing(true)
    setAudioError('')
    try {
      const normalized = await normalizeAudioSample(sample)
      if (normalized.duration < 1 || normalized.duration > 120) {
        if (normalized.objectUrl) URL.revokeObjectURL(normalized.dataUrl)
        throw new Error(t('voiceCreate.audio.durationError'))
      }
      setAudio(normalized)
    } catch (err) {
      setAudio(null)
      setAudioError(err.message || t('voiceCreate.audio.decodeError'))
    } finally {
      setAudioProcessing(false)
    }
  }

  const submit = async (event) => {
    event.preventDefault()
    if (!formReady) return
    setSubmitting(true)
    try {
      const formData = new FormData()
      formData.append('name', name.trim())
      formData.append('description', description.trim())

View on GitHub (pinned to 44413a9d06)

Solutions

  1. Record a sample between 1 and 120 seconds (a few sentences is typical)
  2. If uploading, trim the file to that window first
  3. If the duration looks wrong for a valid file, re-encode to a standard format (WAV/MP3) and retry
Defensive patterns

Strategy: validation

Validate before calling

// Check duration bounds before accepting the sample
function durationWithinBounds(d) {
  return Number.isFinite(d) && d >= 1 && d <= 120
}

Try / catch

// Errors here are expected user-input corrections: render inline, never as toasts
try {
  const normalized = await normalizeAudioSample(sample)
  if (!durationWithinBounds(normalized.duration)) {
    if (normalized.objectUrl) URL.revokeObjectURL(normalized.dataUrl)
    throw new Error(t('voiceCreate.audio.durationError'))
  }
  setAudio(normalized)
} catch (err) {
  setAudio(null)
  setAudioError(err.message || t('voiceCreate.audio.decodeError'))
}

Prevention

When it happens

Trigger: Selecting a recording shorter than 1 s (mic blip, immediate stop) or longer than 120 s (reading a long passage); also a decode that reports a bogus near-zero duration for a corrupt file.

Common situations: User taps record and stops instantly; user uploads a full song or lengthy narration instead of a short sample; truncated/corrupt upload where decodeAudioData yields a tiny duration.

Related errors


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