CSS Inline Error: Warning: DOMXPath::query(): Invalid expression ...emogrifier/Classes/Emogrifier.php on line

Emogrifier tool is great and makes our life easy when it comes to managing CSS for many email templates and keeping track in the version control system as well.

Have you run suddenly in CSS inlining error when using Emogrifier tool and not sure where to start the debugging.
The error pops when converting styles from a CSS file to the inline style attribute of the applicable tags with Emogrifier tool.

A few style declarations especially some wild card CSS selectors are not supported in the version 0.1.1 of emogrifier.
In Magento2 it fires the error somewhere at line number 269.

Looking in the code, it creates xpath from the CSS selectors. So the error is generated while parsing some specific CSS selectors.
The code statement is $nodesMatchingCssSelectors = $xpath->query($this->translateCssToXpath($value['selector']));

Changing the statement to
    $nodesMatchingCssSelectors = $xpath->query($this->translateCssToXpath(preg_replace('/[\[\^\*\]]*/', '', $value['selector'])));
    solves the CSS inlining error as it ignores the wildcard CSS selectors.

Make sure you are not using any wildcard CSS selector for defining styles of your emails.