framework/widgets/ActiveField.php
public function error($options = [])
    {
        if ($options === false) {
            $this->parts['{error}'] = '';
            return $this;
        }
        $options = array_merge($this->errorOptions, $options);
        $this->parts['{error}'] = Html::error($this->model, $this->attribute, $options);

        return $this;
    }
public function error($options = [])
    {
        if ($options === false) {
            $this->parts['{error}'] = '';
            return $this;
        }
        $options = array_merge($this->errorOptions, $options);
        $this->parts['{error}'] = Html::error($this->model, $this->attribute, $options);

        return $this;
    }
Generates a tag that contains the first validation error of [[attribute]].
Note that even if there is no validation error, this method will still return an empty error tag.
@param array|false $options the tag options in terms of name-value pairs. It will be merged with [[errorOptions]].
The options will be rendered as the attributes of the resulting tag. The values will be HTML-encoded
using [[Html::encode()]]. If this parameter is `false`, no error tag will be rendered.

The following options are specially handled:

- `tag`: this specifies the tag name. If not set, `div` will be used.
See also [[\yii\helpers\Html::tag()]].

If you set a custom `id` for the error element, you may need to adjust the [[$selectors]] accordingly.
@see $errorOptions
@return $this the field object itself.