briannesbitt/Carbon · error · Carbon\Exceptions\InvalidFormatException

Could not modify with: {modify}

Error message

Could not modify with: {modify}

What it means

Error "Could not modify with: {modify}" thrown in briannesbitt/Carbon.

Source

Thrown at src/Carbon/Traits/Modifiers.php:443

     * @return static
     */
    public function maximum($date = null)
    {
        return $this->max($date);
    }

    /**
     * Calls \DateTime::modify if mutable or \DateTimeImmutable::modify else.
     *
     * @see https://php.net/manual/en/datetime.modify.php
     *
     * @return static
     */
    #[ReturnTypeWillChange]
    public function modify($modify)
    {
        return parent::modify((string) $modify)
            ?: throw new InvalidFormatException('Could not modify with: '.var_export($modify, true));
    }

    /**
     * Similar to native modify() method of DateTime but can handle more grammars.
     *
     * @example
     * ```
     * echo Carbon::now()->change('next 2pm');
     * ```
     *
     * @link https://php.net/manual/en/datetime.modify.php
     *
     * @param string $modifier
     *
     * @return static
     */
    public function change($modifier)
    {

View on GitHub (pinned to b13f05955d)

When it happens

Trigger: Thrown at src/Carbon/Traits/Modifiers.php:443 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of briannesbitt/Carbon@b13f05955d (2026-08-17). Data as JSON: /api/errors/633603c565c7cbb1. Report an issue: GitHub.