{"record":{"id":"46c79efdf6613dcb","repo":"crewAIInc/crewAI","slug":"audio-filename-duration-duration-1f-s-exce","errorCode":null,"errorMessage":"Audio '{filename}' duration ({duration:.1f}s) exceeds maximum ({constraints.max_duration_seconds}s)","messagePattern":"Audio '(.+?)' duration \\((.+?)s\\) exceeds maximum \\((.+?)s\\)","errorType":"validation","errorClass":"FileValidationError","httpStatus":null,"severity":"error","filePath":"lib/crewai-files/src/crewai_files/processing/validators.py","lineNumber":383,"sourceCode":"    _validate_format(\n        \"Audio\",\n        filename,\n        file.content_type,\n        constraints.supported_formats,\n        errors,\n        raise_on_error,\n    )\n\n    if constraints.max_duration_seconds is not None:\n        duration = _get_audio_duration(content, filename)\n        if duration is not None and duration > constraints.max_duration_seconds:\n            msg = (\n                f\"Audio '{filename}' duration ({duration:.1f}s) exceeds \"\n                f\"maximum ({constraints.max_duration_seconds}s)\"\n            )\n            errors.append(msg)\n            if raise_on_error:\n                raise FileValidationError(msg, file_name=filename)\n\n    return errors\n\n\ndef validate_video(\n    file: VideoFile,\n    constraints: VideoConstraints,\n    *,\n    raise_on_error: bool = True,\n) -> Sequence[str]:\n    \"\"\"Validate a video file against constraints.\n\n    Args:\n        file: The video file to validate.\n        constraints: Video constraints to validate against.\n        raise_on_error: If True, raise exceptions on validation failure.\n\n    Returns:","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-files/src/crewai_files/processing/validators.py#L365-L401","documentation":"validate_audio probes the audio's duration and raises FileValidationError when duration > constraints.max_duration_seconds; the message formats the actual duration with one decimal (e.g. '45.2s') plus the limit. It only fires when duration probing succeeds and the constraint is set.","triggerScenarios":"Validating an audio file (e.g. a 15-minute recording, duration ~900s) against AudioConstraints(max_duration_seconds=60) with raise_on_error=True, or via STRICT-mode processing. Short clips within the limit never trigger it.","commonSituations":"Provider caps on audio length (e.g. speech-to-text or audio-understanding APIs limiting to 25MB / ~1-25 minutes); meeting recordings and podcasts attached whole; max_duration_seconds tuned for voice notes but hit by uploaded files.","solutions":["Split the audio upstream into segments under max_duration_seconds (ffmpeg -f segment).","Raise max_duration_seconds if the provider permits longer audio.","Transcribe long audio externally and attach the transcript as text instead.","Catch FileValidationError and use the reported duration to tell users the accepted limit."],"exampleFix":"# before\nconstraints = AudioConstraints(max_duration_seconds=60)\nvalidate_audio(meeting_recording, constraints)  # FileValidationError: 1873.4s exceeds maximum 60s\n\n# after\n# shell: ffmpeg -i meeting.mp3 -f segment -segment_time 60 -c copy meeting_%02d.mp3\nfor seg in segmented_files:\n    validate_audio(seg, constraints)  # each segment passes","handlingStrategy":"validation","validationCode":"duration = probe_duration(content, filename)  # e.g. via ffprobe/mutagen\nif constraints.max_duration_seconds is not None and duration > constraints.max_duration_seconds:\n    return split_or_reject(file, duration, constraints.max_duration_seconds)","typeGuard":null,"tryCatchPattern":"from crewai_files.processing.exceptions import FileValidationError\n\ntry:\n    processor.process(audio_file)\nexcept FileValidationError as e:\n    if \"duration\" in str(e):\n        return split_audio(file, segment_seconds=constraints.max_duration_seconds)\n    raise","preventionTips":["Probe duration (ffprobe) before validation for user-supplied audio.","Split long recordings with ffmpeg -f segment at the configured limit.","Attach transcripts for long audio instead of raw files."],"tags":["validation","audio","duration","constraints","ffmpeg"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}