It's probably down to a single typo in your notebook, or the fact that you had evaluated different forms of this cell before and then did not restart the kernel (like with mathematica, just deleting a cell does not undo the effects of running the cell).
The following works:
{u,r,\phi,\theta}::Coordinate;
{\mu,\nu,\rho,\sigma,\lambda,\kappa,\chi,\gamma}::Indices(values={u,r,\phi,\theta}, position=fixed);
\partial{#}::PartialDerivative;
g_{\mu\nu}::Metric.
g^{\mu\nu}::InverseMetric.
(you had {u,,r\phi,\theta}::Coordinate;
in the first line, note the comma).
ss:= { g_{u u} = -(1-2 M(u)/r),
g_{r u} = 1,
g_{u r} = 1,
g_{\theta\theta} = r**2,
g_{\phi\phi}= r**2 \sin(\theta)**2
};
complete(ss, $g^{\mu\nu}$);
(unchanged wrt. your file). This does not yet give $g^{uu}=0$ because by default we do not run any simplification on the result of the inversion of the metric. But that's easy to add:
map_sympy(ss, "simplify");
Which gives the expected result for the inverse metric.
If you want to not write $M(u)$ everywhere, but prefer just $M$, simply add (before you start computing)
M::Depends(u);