{"record":{"id":"1591c87cc98ceb5b","repo":"Intervention/image","slug":"call-to-undefined-method-intervention-image-image","errorCode":null,"errorMessage":"Call to undefined method Intervention\\Image\\Image::{name}()","messagePattern":"Call to undefined method Intervention\\\\Image\\\\Image::(.+?)\\(\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/AnimationFactory.php","lineNumber":166,"sourceCode":"\n        // return ready-made frame with all attributes\n        return $image\n            ->core()\n            ->first()\n            ->setDelay($delay)\n            ->setDisposalMethod(DisposalMethod::BACKGROUND->value);\n    }\n\n    /**\n     * Collect processing calls on frame images.\n     *\n     * @param array<null|array<mixed>> $arguments\n     * @throws Error\n     */\n    public function __call(string $name, array $arguments): self\n    {\n        if (!method_exists(Image::class, $name)) {\n            throw new Error('Call to undefined method ' . Image::class . '::' . $name . '()');\n        }\n\n        $this->processingCalls[$this->currentFrameNumber] = $name;\n        $this->processingArguments[$this->currentFrameNumber] = $arguments;\n\n        return $this;\n    }\n}\n","sourceCodeStart":148,"sourceCodeEnd":175,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/AnimationFactory.php#L148-L175","documentation":"resolveDriver() throws this InvalidArgumentException when the string you passed as the driver IS a loadable class, but it does not implement Intervention\\Image\\Interfaces\\DriverInterface (checked with is_subclass_of()). Only real driver implementations can be instantiated by the manager; the class you named exists but is the wrong kind of class.","triggerScenarios":"new ImageManager(['driver' => \\Imagick::class]) — passing the ext-imagick Imagick class instead of Intervention\\Image\\Drivers\\Imagick\\Driver::class; passing a related class like \\Intervention\\Image\\ImageManager::class by mistake; a custom driver class that forgot to 'implements DriverInterface'; passing the abstract base decoder/driver classes from the wrong namespace.","commonSituations":"Confusing the PHP extension class (Imagick) with the library driver class; copy-paste of a use statement importing the similarly named class; writing a custom driver and skipping the interface; IDE auto-complete picking the wrong 'Driver' symbol.","solutions":["Use the shipped drivers: Intervention\\Image\\Drivers\\Gd\\Driver::class or Intervention\\Image\\Drivers\\Imagick\\Driver::class","Check the use statements — make sure you did not import Imagick or another class where the Driver was intended","For custom drivers, add 'implements DriverInterface' and implement all interface methods, then pass YourDriver::class"],"exampleFix":"// before: the imagick extension class, not a driver\nuse Imagick;\n$manager = new ImageManager(['driver' => Imagick::class]);\n\n// after\nuse Intervention\\Image\\Drivers\\Imagick\\Driver;\n$manager = new ImageManager(['driver' => Driver::class]);","handlingStrategy":"type-guard","validationCode":"use Intervention\\Image\\Interfaces\\DriverInterface;\n\nif (is_string($driver) && !is_subclass_of($driver, DriverInterface::class)) {\n    throw new \\RuntimeException($driver . ' is not a driver; use Gd\\Driver::class or Imagick\\Driver::class');\n}\n$manager = new \\Intervention\\Image\\ImageManager(['driver' => $driver]);","typeGuard":"use Intervention\\Image\\Interfaces\\DriverInterface;\n\nfunction isValidDriverClass(string $class): bool\n{\n    return class_exists($class) && is_subclass_of($class, DriverInterface::class);\n}","tryCatchPattern":"use Intervention\\Image\\Exceptions\\InvalidArgumentException;\n\ntry {\n    $manager = new \\Intervention\\Image\\ImageManager(['driver' => $candidate]);\n} catch (InvalidArgumentException $e) {\n    // message names DriverInterface: the class exists but is the wrong type — fix the config value\n}","preventionTips":["Keep exactly two allowed values in config (the two shipped Driver::class constants) and validate against them","Do not import Imagick in files that configure the manager; import the library Driver classes","For custom drivers, write a unit test asserting your class implements DriverInterface"],"tags":["driver","invalid-argument","interface","intervention-image"],"backgroundTag":"invalid-driver-class","analyzedSha":"5598b9e39751c34afc5cdee84abef77f92c26f68","analyzedAt":"2026-08-23T02:17:31.068Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}