public function fail(string $group, string $message)
    {
        if ($this->completed || $this->failed) {
            throw new JobAlreadyFinishedException();
        }

        $jsonData = json_encode($this->data, JSON_UNESCAPED_SLASHES) ?: '{}';

        $this->getEventsManager()->fire(new JobEvent\OnFailure($this, $this, $group, $message));

        $this->failed = true;

        return $this->client->fail($this->jid, $this->worker, $group, $message, $jsonData);
    }