The codes are below:



Index = IndexRange[a, m]
DefManifold[M, 4, Index]
DefMetric[-1, metric[-a, -b], CD, PrintAs -> "g"]

As I press down shift and enter,it reads:"VBundleOfMetric:Unknown metric Removed[metric]". And I tried to use EulerDensity in xTras:

GBterm = NoScalar @ EulerDensity[CD]

it reads:"MetricOfVBundle:Unknown vbundle Removed[TangentM]" and "Throw:Uncaught Throw[Null] to top level".

I don't know how this happens,and try to reopen the file but failed.

  • $\begingroup$ In general, it is better to use ClearAll rather than Remove. Perhaps this will solve your issue, in addition to the advice of the existing answer. $\endgroup$ Commented Mar 23, 2023 at 20:28

1 Answer 1


It appears Remove["Global`*"] is not that safe in xact: as you can see, the error refers to Removed[TangentM] meaning that xact still had a reference to it. You can try restarting the kernel instead of running Remove["Global`*"]. Another alternative to Remove[...] is to use Undef* functions provided by xact like UndefManifold[M]. It is also generally advised against introducing variables starting from a capital letter (like Index you are using) to avoid the conflict with Mathematica definitions. I started a new kernel and ran

<< xAct`xTensor`;
<< xAct`xTras`;
ii = IndexRange[a, m];
DefManifold[M, 4, ii];
DefMetric[-1, metric[-a, -b], CD, PrintAs -> "g"];
GBterm = NoScalar@EulerDensity[CD]

and the issue didn't reproduce.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.