Fix #8262: check tag's validity before building. Upstream-commit: 22bd54be4a3ab1976336035e7196b9c3fe6f251b Component: engine