{"record":{"id":"8a7a13f5ba02c497","repo":"Intervention/image","slug":"invalid-position-argument-must-be-int-0-max","errorCode":null,"errorMessage":"Invalid position argument. Must be int<0, max>","messagePattern":"Invalid position argument\\. Must be int<0, max>","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Modifiers/RemoveAnimationModifier.php","lineNumber":20,"sourceCode":"\ndeclare(strict_types=1);\n\nnamespace Intervention\\Image\\Modifiers;\n\nuse Intervention\\Image\\Drivers\\SpecializableModifier;\nuse Intervention\\Image\\Exceptions\\InvalidArgumentException;\nuse Intervention\\Image\\Interfaces\\FrameInterface;\nuse Intervention\\Image\\Interfaces\\ImageInterface;\n\nclass RemoveAnimationModifier extends SpecializableModifier\n{\n    /**\n     * @throws InvalidArgumentException\n     */\n    public function __construct(public int|string $position = 0)\n    {\n        if (is_int($this->position) && $this->position < 0) {\n            throw new InvalidArgumentException('Invalid position argument. Must be int<0, max>');\n        }\n    }\n\n    /**\n     * @throws InvalidArgumentException\n     */\n    protected function selectedFrame(ImageInterface $image): FrameInterface\n    {\n        return $image->core()->frame($this->normalizePosition($image));\n    }\n\n    /**\n     * Return the position of the selected frame as integer.\n     *\n     * @throws InvalidArgumentException\n     */\n    protected function normalizePosition(ImageInterface $image): int\n    {","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/Modifiers/RemoveAnimationModifier.php#L2-L38","documentation":"Error \"Invalid position argument. Must be int<0, max>\" thrown in Intervention/image.","triggerScenarios":"Thrown at src/Modifiers/RemoveAnimationModifier.php:20 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a frame position of 0 or greater to removeAnimation()","Use a percentage string like \"50%\" when addressing frames relatively","Validate the position against the animation's frame count before calling"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5598b9e39751c34afc5cdee84abef77f92c26f68","analyzedAt":"2026-08-23T02:17:31.068Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}