When is the equation $\vec{L}=I\vec{\omega}$ not valid? 
When is the equation $\vec{L}=I\vec{\omega}$ not valid?

Let me clarify, I've encountered a few problems where the angular momentum you obtained by integrating and the angular momentum you'd obtain by using the expression $\vec{L}=I\vec{\omega}$, one example can be this situation:

A rigid shaft of negligible mass rotates on itself with
constant angular velocity ω. A straight rod of length 2a, mass
m, whose section and density are uniform, is rigidly attached to the axis
through its center O, as seen in this figure I'm adding, forming a constant angle α with it.





Because what you get integrating: $$\vec{dL}=\vec{r}\times d\vec{p}\Rightarrow dL=rv\cdot dm\sin\alpha=r^2\omega \sin\alpha dm$$ with the definition of linear density $dm=\lambda dr=\frac{m}{2a}dr$: $$dL=\frac{m\omega \sin\alpha}{2a}r^2dr\Rightarrow L=\frac{m\omega \sin\alpha}{2a}\int_{-a}^a r^2dr=\frac{m\omega\sin\alpha}{3}a^2$$ and then with the expression I'm talking about $$L=I\omega=\frac{m}{3}\sin^2\alpha a^2\omega$$ which both aren't the same.
So I'm guessing that the $\vec{L}=I\vec{\omega}$ is only valid when $\vec{L}$ is parallel to $\vec{\omega}$? And if that is even true, how would I know that to begin with, do I have to apply the right-hand rule to know the directions of both, and then if both are parallel, then I'm allowed to use it?
 A: The equation $$\boldsymbol{L}_A = {\rm I}_A \boldsymbol{\omega}$$ is always valid for any arbitrary point A provided that the correct mass moment of inertia tensor summed about A is used.
If you are asking when is $\boldsymbol{L} = {\rm I}_{\rm COM} \boldsymbol{\omega}$ is valid, then the answer would be at the center of mass only, because the mass moment of inertia is provided as the center of mass.
For example, a thin rod of mass $m$ and length $\ell$ in 2D has
$$ \begin{aligned}
{L}_{\rm center} & = \left( \tfrac{m}{12} \ell^2 \right) {\omega}  & & \text{at COM} \\
{L}_{\rm end} & = \left( \tfrac{m}{3} \ell^2 \right) {\omega}  & & \text{at end point}
\end{aligned}$$
The above are scalar equations, but the general form is a vector equation in 3D.
It is always valid since it is the definition of mass moment of inertia at any location.
Consider a body rotating about an arbitrary point A.
Given $\boldsymbol{L}_{\rm COM} = {\rm I}_{\rm COM} \boldsymbol{\omega}$ at the center of mass, and angular momentum at an arbitrary point $$ \boldsymbol{L}_A = \boldsymbol{L}_{\rm COM} + \boldsymbol{c} \times \boldsymbol{p}$$ where $\boldsymbol{c}$ is the position vector of the center of mass w.r.t. the arbitrary point and $\boldsymbol{p}$ is linear momentum, then find ${\rm I}_A$ such that $ \boldsymbol{L}_A = {\rm I}_A \boldsymbol{\omega} $
The motion of the center of mass is $\boldsymbol{v}_{\rm COM} = \boldsymbol{\omega} \times \boldsymbol{c}$ and thus momentum is
$$ \boldsymbol{p} = m ( \boldsymbol{\omega} \times \boldsymbol{c} )$$
Now moment of inertia about A can be calculated
$$ \begin{aligned}\boldsymbol{L}_{A} & ={\rm I}_{A}\boldsymbol{\omega}\\
\boldsymbol{L}_{{\rm COM}}+\boldsymbol{c}\times\boldsymbol{p} & ={\rm I}_{A}\boldsymbol{\omega}\\
{\rm I}_{{\rm COM}}\boldsymbol{\omega}+m\left(\boldsymbol{c}\times(\boldsymbol{\omega}\times\boldsymbol{c})\right) & ={\rm I}_{A}\boldsymbol{\omega}\\
{\rm I}_{{\rm COM}}\boldsymbol{\omega}+m\left(\boldsymbol{\omega}\left(\boldsymbol{c}\cdot\boldsymbol{c}\right)-\boldsymbol{c}\left(\boldsymbol{c}\cdot\boldsymbol{\omega}\right)\right) & ={\rm I}_{A}\boldsymbol{\omega}\\
{\rm I}_{{\rm COM}}\boldsymbol{\omega}+m\left(\left(\boldsymbol{c}^{\intercal}\boldsymbol{c}\right)1-\boldsymbol{c}\boldsymbol{c}^{\intercal}\right)\boldsymbol{\omega} & ={\rm I}_{A}\boldsymbol{\omega}
\end{aligned}
 $$
and finally
$$ {\rm I}_{A}={\rm I}_{{\rm COM}}+m\left(\left(\boldsymbol{c}^{\intercal}\boldsymbol{c}\right)1-\boldsymbol{c}\boldsymbol{c}^{\intercal}\right) $$
which is the parallel axis theorem in vector form. Note that the $1$ above denotes the 3×3 identity matrix.
A: In the most general case, the moment of inertia is a tensor (matrix). Roughly speaking, it appears because angular momentum is defined using a cross product. Taking the cross product of a vector with another vector is a linear operation and so it can be represented by a matrix.
\begin{align}
\vec L&=\sum_i \vec r_i\times\vec p_i\\
&=\sum_i\vec r_i\times(m_i\vec v_i)\\
&=\sum_im_i\vec r_i\times(\vec \omega_i\times \vec r_i)\\
&=-\sum_im_i\vec r_i\times(\vec r_i\times \vec \omega_i)
\end{align}
Let's ignore the sum for one second and let's look at the moment of inertia for a single particle. One can show that $$\vec r\times\vec \omega =\underbrace{\left(
\begin{array}{ccc}
 0 & -z & y \\
 z & 0 & -x \\
 -y & x & 0 \\
\end{array}
\right)}_{R}\vec \omega$$
and
\begin{align}
-m\vec r\times(\vec r\times \vec \omega)&=-mR^2\vec\omega\\
&=m\left(
\begin{array}{ccc}
 y^2+z^2 & -x y & -x z \\
 -x y & x^2+z^2 & -y z \\
 -x z & -y z & x^2+y^2 \\
\end{array}
\right)\vec\omega\\
&=I\vec\omega
\end{align}
If we constrain the body to only rotate around the z-axis, only the component in the z-direction matters. We get $L_z=m(x^2+y^2)\omega_z$. If we drop the z index we get precisely the formula you are used to: $L=m(x^2+y^2)\omega$. Conclusion: for 2D objects the moment of inertia is a scalar, but for 3D objects the moment of inertia is generally a tensor (matrix).
Now you might ask: how does it look like when the angular momentum is not aligned with the axis of rotation? An example is shown here below. A better quality video can be found here. A nice explanation can be found here. The angular momentum is conserved in this case so it is always pointing in the same direction, but the axis of rotation varies wildly. Note that for this video the initial and final axis of rotation are the same ($\omega$ points out of your screen and to the left), but in between the axis rotation has to change for it to flip over.

A: The moment of inertia, $I$, is represented by 9 element tensor and transforms according to a strict set of rules. The equation you've quoted is a definition, so always true.
Based on your question, though, I'm guessing that the word tensor was not used to introduce this and you're looking for the moment of inertia about vector which must be co-linear with $\vec\omega$. As such, you seek the correct moment of inertia rather than the correct formula.
