I'm afraid I found my first severe compiler error. Unfortunately, I do not know yet how to workaround. I cannot even see how to localize it.
fricas
(1) -> <spad>
fricas
)abbrev package TEST Test
Test(): Exports == Implementation where
   NNI ==> NonNegativeInteger
   Exports == with
     subsetToComp: List Integer -> List NNI
   Implementation == add
     subsetToComp v ==
       res: List NNI := []</spad>
fricas
Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/125188740751070590-25px001.spad
      using old system compiler.
   TEST abbreviates package Test 
------------------------------------------------------------------------
   initializing NRLIB TEST for Test 
   compiling into NRLIB TEST 
   compiling exported subsetToComp : List Integer -> List NonNegativeInteger
      TEST;subsetToComp;LL;1 is replaced by LETres 
Time: 0 SEC.
(time taken in buildFunctor:  0)
Time: 0 SEC.
   Cumulative Statistics for Constructor Test
      Time: 0 seconds
   finalizing NRLIB TEST 
   Processing Test for Browser database:
--->-->Test(constructor): Not documented!!!!
--->-->Test((subsetToComp ((List (NonNegativeInteger)) (List (Integer))))): Not documented!!!!
--->-->Test(): Missing Description
; compiling file "/var/aw/var/LatexWiki/TEST.NRLIB/TEST.lsp" (written 10 AUG 2025 08:26:30 AM):
; wrote /var/aw/var/LatexWiki/TEST.NRLIB/TEST.fasl
; compilation finished in 0:00:00.012
------------------------------------------------------------------------
   Test is now explicitly exposed in frame initial 
   Test will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/TEST.NRLIB/TESTfricas
)set stream calculate 3
s := coefficients series(q^(m-i),q=1)
Type: Stream(Expression(Integer))
fricas
)lib TEST
   Test is already explicitly exposed in frame initial 
   Test will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/TEST.NRLIB/TEST
eval(s.2,i,%A)
Type: Expression(Integer)
fricas
eval(s.2,i,%B)
Type: Expression(Integer)
Obviously, the final lines should read m-%A and m-%B. The error seems to go away if the series is generated after the )lib command or if the series contains no other variables apart from q and i. Furthermore, %A seems to be somehow special, but I cannot reproduce this peculiarity here.
I would be very grateful if somebody could at least localize the error, so that I can determine when it happens. This bug has unfortunately tremendous implications, for example, a product like  is replaced by
 is replaced by  ...
...
If we issue the )lib command before defining any variables, the problem goes away.
Actually core of the problem is how Expression works.  More precisely Expression uses Kernel and Kernels are cached inside
SortedCache?.  In order to force use of newly loaded domain )lib has to invalidate all existing domains, including
SortedCache? storing cached kernels.  In effect all Kernel-s (hence Expression-s) stored in variables became invalid.
In many cases those invalid expressions still give sensible results so one may be fooled to think that expressions
should work after )lib, but this is not the case...
Status: open => rejected