How to yii2 addError for array[key]

public function beforeValidate() {

    if(isset($this->detailsData[5]) && !$this->detailsData[5]){
        $this->addError('detailsData[5]', 'error msg');
        return false;
    }

    return parent::beforeValidate();
}

I am trying to show error msg on a particular array key in ActiveForm