Skip to content

fix(cli): improve error message for zero-duration composition renders#129

Closed
miguel-heygen wants to merge 1 commit into03-29-fix_cli_catch_output_directory_creation_errors_in_renderfrom
03-29-fix_cli_improve_error_message_for_zero-duration_composition_renders
Closed

fix(cli): improve error message for zero-duration composition renders#129
miguel-heygen wants to merge 1 commit into03-29-fix_cli_catch_output_directory_creation_errors_in_renderfrom
03-29-fix_cli_improve_error_message_for_zero-duration_composition_renders

Conversation

@miguel-heygen
Copy link
Copy Markdown
Collaborator

@miguel-heygen miguel-heygen commented Mar 29, 2026

PR Stack

# PR Status
1 #122 — fix: info width/height swap ← base
2 #123 — fix: include all 9 templates in build
3 #124 — fix: suppress ANSI in non-TTY
4 #125 — fix: lint --json error paths
5 #126 — fix: separate info/warning counts
6 #127 — fix: lint severity display
7 #128 — fix: render output path error
8 #129 — fix: zero-duration error message ← top

Summary

  • When a composition had zero duration (empty GSAP timeline, no data-duration), Docker render hung for 45s then showed the misleading hint "Check Docker is running" even though Docker was fine
  • Now detects the __hf not ready timeout error and provides a context-aware hint about zero duration instead

Reproducer

# Create a composition with an empty GSAP timeline and no data-duration
cat > index.html << 'HTML'
<div data-composition-id="test" data-width="1920" data-height="1080" data-start="0">
  <script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
  <script>
    window.__timelines = window.__timelines || {};
    window.__timelines["test"] = gsap.timeline({ paused: true });
    // No tweens — timeline has zero duration
  </script>
</div>
HTML
npx hyperframes render --docker --output out.mp4
# Was: "Check Docker is running: docker info"
# Now: "Composition may have zero duration. Add data-duration to the root element or ensure the GSAP timeline has tweens."

Stack

8/8 — Depends on #128. Last PR in the stack.

🤖 Generated with Claude Code

@miguel-heygen miguel-heygen force-pushed the 03-29-fix_cli_catch_output_directory_creation_errors_in_render branch from bb3bcd2 to 1704c30 Compare March 29, 2026 11:38
@miguel-heygen miguel-heygen force-pushed the 03-29-fix_cli_improve_error_message_for_zero-duration_composition_renders branch from a415c64 to fbd77c3 Compare March 29, 2026 11:38
@miguel-heygen miguel-heygen force-pushed the 03-29-fix_cli_improve_error_message_for_zero-duration_composition_renders branch from fbd77c3 to ab1a5a1 Compare March 29, 2026 11:39
@miguel-heygen miguel-heygen force-pushed the 03-29-fix_cli_catch_output_directory_creation_errors_in_render branch from 1704c30 to 898d7c4 Compare March 29, 2026 11:39
Copy link
Copy Markdown
Collaborator Author

@miguel-heygen miguel-heygen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two issues:

1. message.includes("duration") is too broad

The "__hf not ready" check alone covers the zero-duration failure path (the engine error at frameCapture.ts:251 already contains that substring). The || message.includes("duration") branch will false-positive on unrelated errors — e.g. FFmpeg failures containing "Invalid duration", ffprobe output parsing, audio mixer issues — all of which would incorrectly get the "Composition may have zero duration" hint instead of the Docker hint.

Recommend removing the || message.includes("duration") branch entirely, or narrowing to something very specific like message.includes("duration > 0").

2. Same error can occur in renderLocal path

The renderLocal catch block (line ~298) still shows a generic hint. The same __hf not ready error originates from frameCapture.ts which is used by both render paths. Consider extracting the hint-selection into a helper and applying it to both paths:

function renderHintForError(error: unknown, fallback: string): string {
  const message = error instanceof Error ? error.message : String(error);
  if (message.includes("__hf not ready")) {
    return "Composition may have zero duration. Add data-duration to the root element or ensure the GSAP timeline has tweens.";
  }
  return fallback;
}

When a composition had zero duration (empty GSAP timeline, no
data-duration), Docker render hung for 45s then showed the misleading
hint "Check Docker is running" even though Docker was fine. Now
detects the __hf-not-ready error and suggests adding data-duration or
GSAP tweens instead.

Reproducer:
  # Create composition with empty timeline and no data-duration
  npx hyperframes render --docker --output out.mp4
  # Was: "Check Docker is running: docker info"
  # Now: "Composition may have zero duration. Add data-duration..."
@miguel-heygen miguel-heygen force-pushed the 03-29-fix_cli_catch_output_directory_creation_errors_in_render branch from 898d7c4 to 5430f9a Compare March 29, 2026 11:51
@miguel-heygen miguel-heygen force-pushed the 03-29-fix_cli_improve_error_message_for_zero-duration_composition_renders branch from ab1a5a1 to 17f11f7 Compare March 29, 2026 11:51
Copy link
Copy Markdown
Collaborator Author

@miguel-heygen miguel-heygen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed both points: (1) removed broad includes("duration"), now only matches "__hf not ready". (2) Extracted renderHintForError() helper and applied to both renderDocker and renderLocal catch blocks.

@miguel-heygen
Copy link
Copy Markdown
Collaborator Author

Consolidated into fix/render-improvements.

@miguel-heygen miguel-heygen deleted the 03-29-fix_cli_improve_error_message_for_zero-duration_composition_renders branch April 6, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant