Assume that $E$ is a bundle of Lie Algebras. Let $g$ be an invariant metric on $E$, that is for all $p\in M$, $$g\_p([x,y],z)+g\_p(y,[x,z])=0,$$ where $x,y,z\in E\_p$ are arbitrary.


Is there a Riemannian connection $\nabla$ on $E$ such that:
$$\nabla\_U[X,Y]=[\nabla\_U X,Y]+[X,\nabla\_U Y]$$ holds for every $U\in \mathcal{X}(M)$ and $X,Y\in\Gamma E?$



Special Riemannian connections?
The answer is 'no, not always'. 


Here's an example: Let $E\to M$ be an oriented Riemannian $3$-plane bundle over $M$, with inner product $g$. Then there is a well-defined bilinear cross-product operation on sections $\times :\Gamma E \times \Gamma E \to \Gamma E$ with the property that, if $X$ and $Y$ are unit-length, orthogonal local sections of $E$ over $V\subset M$, then $X\times Y$ is also unit-length and $\bigl(X,Y,X{\times}Y\bigr)$ is an oriented orthonormal basis of sections of $E$ over $V$. 


Now let $\lambda$ be any function on $M$ that is not locally constant and define
$$
[X,Y] = \lambda\ X{\times}Y.
$$
This makes $E$ into an Euclidean bundle of Lie algebras that satisfies your assumptions, but, because $\lambda$ is not locally constant, there is no $g$-compatible connection $\nabla$ on $E$ that makes the Lie algebra structure $[,]$ be $\nabla$-parallel. The reason is that the cross-product *will* be $\nabla$-parallel as a section $C$ of $E\otimes\Lambda^2(E^\ast)$ (with the connection it inherits from $E$), but the Lie algebra product, which is a section $P$ of $E\otimes\Lambda^2(E^\ast)$, is $\lambda$ times $C$ and so will not be $\nabla$-parallel, which is what your condition requires.


**N.B.:** Note that the concept of torsion has nothing to do with this problem because $E$ is not assumed to be a subbundle of the tangent bundle, and, in any case, $[X,Y]$ need not be the Lie bracket of vector fields. (I think that this may have misled the (first) commenter above.)


