An MWE is like this:
\documentclass{article}
\usepackage{unicode-math}
\DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n}
\begin{document}
$ \tilde{\mathcal{B}} $
% $ \hat{\mathcal{B}} $
\end{document}
The error shows "! Internal error: bad native font flag in `map_char_to_glyph'".
It seems that \DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n}
is not compatible with unicode-math
. Any advice is appreciated!