Intervention/image · error · InvalidArgumentException

Property {name} does not exists for {this::class}

Error message

Property {name} does not exists for {this::class}

What it means

Config::setOptions() only accepts keys matching real properties of the Config class. The library ships exactly four: autoOrientation, decodeAnimation, backgroundColor and strip. Any other key, whether passed as a named argument or inside an array, is rejected with the offending property name in the message.

Source

Thrown at src/Config.php:33

    public function __construct(
        public bool $autoOrientation = true,
        public bool $decodeAnimation = true,
        public string|ColorInterface $backgroundColor = 'ffffff',
        public bool $strip = false,
    ) {
        //
    }

    /**
     * Set values of given config options.
     *
     * @throws InvalidArgumentException
     */
    public function setOptions(mixed ...$options): self
    {
        foreach ($this->prepareOptions($options) as $name => $value) {
            if (!property_exists($this, $name)) {
                throw new InvalidArgumentException('Property ' . $name . ' does not exists for ' . $this::class);
            }

            $this->{$name} = $value;
        }

        return $this;
    }

    /**
     * This method makes it possible to call self::setOptions() with a single
     * array instead of named parameters.
     *
     * @param array<mixed> $options
     * @return array<mixed>
     */
    private function prepareOptions(array $options): array
    {
        if ($options === []) {

View on GitHub (pinned to 5598b9e397)

Solutions

  1. Use only the supported keys: autoOrientation, decodeAnimation, backgroundColor, strip
  2. Rename the v2 'autoOrient' key to 'autoOrientation' when upgrading to v3
  3. Compare the key in the exception message against the public properties in src/Config.php

Example fix

// before
$manager = new ImageManager(['autoOrient' => true]);

// after
$manager = new ImageManager(['autoOrientation' => true]);
Defensive patterns

Strategy: validation

Validate before calling

$allowed = ['autoOrientation', 'decodeAnimation', 'backgroundColor', 'strip'];
$options = array_intersect_key($userOptions, array_flip($allowed));
$manager = new ImageManager($options);

Prevention

When it happens

Trigger: new ImageManager(['autoOrient' => true]) (v2 spelling), setOptions(['background' => 'ff0000']) (truncated name), or any option removed or renamed in the major version you are using.

Common situations: Upgrading from Intervention Image v2 to v3 where 'autoOrient' became 'autoOrientation'; typos in option keys; copying configuration snippets from other projects or older docs.

Related errors


AI-assisted analysis of Intervention/image@5598b9e397 (2026-08-23). Data as JSON: /api/errors/cc819f1ff3fc6298. Report an issue: GitHub.