crewAIInc/crewAI · error · FileValidationError

Video '{filename}' duration ({duration:.1f}s) exceeds maximu

Error message

Video '{filename}' duration ({duration:.1f}s) exceeds maximum ({constraints.max_duration_seconds}s)

What it means

validate_video probes the video's duration and raises FileValidationError when duration > constraints.max_duration_seconds (message shows actual duration at one decimal and the limit). It is the video counterpart of the audio check and runs only when duration extraction succeeds and the constraint is set.

Source

Thrown at lib/crewai-files/src/crewai_files/processing/validators.py:440

    _validate_format(
        "Video",
        filename,
        file.content_type,
        constraints.supported_formats,
        errors,
        raise_on_error,
    )

    if constraints.max_duration_seconds is not None:
        duration = _get_video_duration(content)
        if duration is not None and duration > constraints.max_duration_seconds:
            msg = (
                f"Video '{filename}' duration ({duration:.1f}s) exceeds "
                f"maximum ({constraints.max_duration_seconds}s)"
            )
            errors.append(msg)
            if raise_on_error:
                raise FileValidationError(msg, file_name=filename)

    return errors


def validate_text(
    file: TextFile,
    constraints: ProviderConstraints,
    *,
    raise_on_error: bool = True,
) -> Sequence[str]:
    """Validate a text file against general constraints.

    Args:
        file: The text file to validate.
        constraints: Provider constraints to validate against.
        raise_on_error: If True, raise exceptions on validation failure.

    Returns:

View on GitHub (pinned to 754d7323be)

Solutions

  1. Split the video upstream with ffmpeg (-f segment or -ss/-t cuts) into clips under max_duration_seconds.
  2. Raise max_duration_seconds within the provider's documented cap.
  3. Extract key frames or a transcript and attach those as images/text instead of full video.
  4. Catch FileValidationError and surface the duration numbers to the uploader.

Example fix

# before
constraints = VideoConstraints(max_duration_seconds=120)
validate_video(screen_recording, constraints)  # FileValidationError: 612.0s exceeds maximum 120s

# after
# shell: ffmpeg -i recording.mp4 -f segment -segment_time 120 -c copy rec_%02d.mp4
for clip in segmented_clips:
    validate_video(clip, constraints)  # each clip passes
Defensive patterns

Strategy: validation

Validate before calling

duration = probe_video_duration(content)  # ffprobe
if constraints.max_duration_seconds is not None and duration > constraints.max_duration_seconds:
    return split_or_reject(file, duration, constraints.max_duration_seconds)

Try / catch

from crewai_files.processing.exceptions import FileValidationError

try:
    processor.process(video_file)
except FileValidationError as e:
    if "duration" in str(e):
        return split_video(file, segment_seconds=constraints.max_duration_seconds)
    raise

Prevention

When it happens

Trigger: Validating a video (e.g. a 10-minute clip, 600s) against VideoConstraints(max_duration_seconds=120) with raise_on_error=True or through STRICT-mode processing. Videos under the limit pass.

Common situations: Video-understanding providers capping clip length (often 1-10 minutes); screen recordings and event footage attached whole; limits configured for short clips but hit by full uploads.

Related errors


AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15). Data as JSON: /api/errors/2ea7f1207da36803. Report an issue: GitHub.