Skip to content

Truncated responses due to uncaught error on backend #1209

Description

@RobotRoss

Describe the bug

When working on coding tasks, the response from the model (In my case, Gemma4) often gets truncated due to a silent error occurring on the backend.

Expected behavior

Response runs to full length.

Debugging information

Alpaca v9.2.4 , Flathub

Traceback (most recent call last):
  File "/app/share/Alpaca/alpaca/widgets/message.py", line 172, in add_content
    for block in blocks.text_to_block_list(content):
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/app/share/Alpaca/alpaca/widgets/blocks/__init__.py", line 69, in text_to_block_list
    blocks.append(LatexRenderer(content=content))
                  ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/app/share/Alpaca/alpaca/widgets/blocks/latex.py", line 84, in __init__
    self.set_content(content)
    ~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/app/share/Alpaca/alpaca/widgets/blocks/latex.py", line 94, in set_content
    self.canvas.set_text('${}$'.format(content))
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/share/Alpaca/alpaca/widgets/blocks/latex.py", line 36, in set_text
    self.fig.canvas.draw()
    ~~~~~~~~~~~~~~~~~~~~^^
  File "/app/lib/python3.13/site-packages/matplotlib/backends/backend_agg.py", line 382, in draw
    self.figure.draw(self.renderer)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/app/lib/python3.13/site-packages/matplotlib/artist.py", line 94, in draw_wrapper
    result = draw(artist, renderer, *args, **kwargs)
  File "/app/lib/python3.13/site-packages/matplotlib/artist.py", line 71, in draw_wrapper
    return draw(artist, renderer)
  File "/app/lib/python3.13/site-packages/matplotlib/figure.py", line 3257, in draw
    mimage._draw_list_compositing_images(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        renderer, self, artists, self.suppressComposite)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.13/site-packages/matplotlib/image.py", line 134, in _draw_list_compositing_images
    a.draw(renderer)
    ~~~~~~^^^^^^^^^^
  File "/app/lib/python3.13/site-packages/matplotlib/artist.py", line 71, in draw_wrapper
    return draw(artist, renderer)
  File "/app/lib/python3.13/site-packages/matplotlib/axes/_base.py", line 3181, in draw
    mimage._draw_list_compositing_images(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        renderer, self, artists, self.get_figure(root=True).suppressComposite)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.13/site-packages/matplotlib/image.py", line 134, in _draw_list_compositing_images
    a.draw(renderer)
    ~~~~~~^^^^^^^^^^
  File "/app/lib/python3.13/site-packages/matplotlib/artist.py", line 71, in draw_wrapper
    return draw(artist, renderer)
  File "/app/lib/python3.13/site-packages/matplotlib/text.py", line 752, in draw
    bbox, info, descent = self._get_layout(renderer)
                          ~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/app/lib/python3.13/site-packages/matplotlib/text.py", line 382, in _get_layout
    w, h, d = _get_text_metrics_with_cache(
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        renderer, clean_line, self._fontproperties,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        ismath=ismath, dpi=self.get_figure(root=True).dpi)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.13/site-packages/matplotlib/text.py", line 69, in _get_text_metrics_with_cache
    return _get_text_metrics_with_cache_impl(
        weakref.ref(renderer), text, fontprop.copy(), ismath, dpi)
  File "/app/lib/python3.13/site-packages/matplotlib/text.py", line 77, in _get_text_metrics_with_cache_impl
    return renderer_ref().get_text_width_height_descent(text, fontprop, ismath)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.13/site-packages/matplotlib/backends/backend_agg.py", line 215, in get_text_width_height_descent
    self.mathtext_parser.parse(s, self.dpi, prop)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.13/site-packages/matplotlib/mathtext.py", line 86, in parse
    return self._parse_cached(s, dpi, prop, antialiased, load_glyph_flags)
           ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.13/site-packages/matplotlib/mathtext.py", line 100, in _parse_cached
    box = self._parser.parse(s, fontset, fontsize, dpi)
  File "/app/lib/python3.13/site-packages/matplotlib/_mathtext.py", line 2173, in parse
    raise ValueError("\n" + ParseException.explain(err, 0)) from None
ValueError: 
$(printf '%s\n' "$
^
ParseException: Expected end of text, found '$'  (at char 0), (line:1, col:1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions