Intervention/image · error · DriverException
Failed to get frame delay
Error message
Failed to get frame delay
What it means
Frame::delay() reads the per-frame animation delay as getImageDelay() / 100 (src/Drivers/Imagick/Frame.php:109) — seconds from ImageMagick's 1/100s ticks — and wraps any ImagickException as DriverException. It fails when the frame's native Imagick is no longer usable (cleared/destroyed or corrupted), typically while iterating frames of an animated GIF/WebP.
Source
Thrown at src/Drivers/Imagick/Frame.php:111
);
} catch (ImagickException | InvalidArgumentException $e) {
throw new DriverException('Failed to get frame size', previous: $e);
}
}
/**
* {@inheritdoc}
*
* @see DriverInterface::delay()
*
* @throws DriverException
*/
public function delay(): float
{
try {
return $this->native->getImageDelay() / 100;
} catch (ImagickException $e) {
throw new DriverException('Failed to get frame delay', previous: $e);
}
}
/**
* {@inheritdoc}
*
* @see DriverInterface::setDelay()
*
* @throws DriverException
*/
public function setDelay(float $delay): FrameInterface
{
try {
$this->native->setImageDelay(intval(round($delay * 100)));
} catch (ImagickException $e) {
throw new DriverException('Failed to set frame disposal method', previous: $e);
}
View on GitHub (pinned to 5598b9e397)
Solutions
- Inspect $e->getPrevious()->getMessage() for the underlying ImageMagick error
- Never clear()/destroy() frame natives while the Frame object is still in use
- Re-read the animation from its source when errors occurred earlier in the pipeline
- Fail fast: stop frame iteration on the first wrapped error
Defensive patterns
Strategy: try-catch
Try / catch
use Intervention\Image\Exceptions\DriverException;
try {
$delay = $frame->delay();
} catch (DriverException $e) {
// native frame is unusable; re-read the animation instead of guessing
error_log('Frame delay failed: ' . $e->getPrevious()?->getMessage());
throw $e;
} Prevention
- Do all frame reads (delay, size, offset) before any manual teardown of natives
- Re-read animated sources from disk rather than reusing frames after errors
- Validate animation uploads with a full decode before storing them
When it happens
Trigger: Iterating $image->frames() of an animated GIF/WebP and calling delay() after manual clear()/destroy() of the native; operating on a partially decoded or corrupted animation whose frame native is invalid.
Common situations: Custom animation processing that frees resources mid-loop; corrupted uploads that decode only partially; modifiers holding stale frame references after an earlier exception was swallowed.
Related errors
- Failed to set frame disposal method
- Failed to get frame size
- Failed to add image frame
- Failed to iterate image frames
- Failed to load image frame a position
AI-assisted analysis of Intervention/image@5598b9e397 (2026-08-23).
Data as JSON: /api/errors/32d96c1325565a47.
Report an issue: GitHub.