mkdocs-material: Social plugin crashes after updating CairoSVG to 2.8.0

Context

Very recently docs building started to fail on ubuntu workers on both RTD and GHA, even if we use lock files for pinning python dependencies.

This seems to be related to the social plugin based on the stacktrace.

Bug description

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/mkdocs/__main__.py", line 370, in <module>
    cli()
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/click/core.py", line 1442, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/click/core.py", line 1363, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/click/core.py", line 1830, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/click/core.py", line 1226, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/click/core.py", line 794, in invoke
    return callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/mkdocs/__main__.py", line 288, in build_command
    build.build(cfg, dirty=not clean)
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/mkdocs/commands/build.py", line 347, in build
    config.plugins.on_post_build(config=config)
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/mkdocs/plugins.py", line 602, in on_post_build
    return self.run_event('post_build', config=config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/mkdocs/plugins.py", line 568, in run_event
    result = method(**kwargs)
             ^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 234, in on_post_build
    promise.result()
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 241, in _cache_image
    image = render_function()
            ^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 221, in <lambda>
    render_function = lambda: self._render_card(site_name, title, description)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 256, in _render_card
    self._resized_logo_promise.result(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 241, in _cache_image
    image = render_function()
            ^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 221, in <lambda>
    render_function = lambda: self._render_card(site_name, title, description)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 256, in _render_card
    self._resized_logo_promise.result(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 241, in _cache_image
    image = render_function()
            ^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 221, in <lambda>
    render_function = lambda: self._render_card(site_name, title, description)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 256, in _render_card
    self._resized_logo_promise.result(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 241, in _cache_image
    image = render_function()
            ^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 221, in <lambda>
    render_function = lambda: self._render_card(site_name, title, description)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 256, in _render_card
    self._resized_logo_promise.result(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 241, in _cache_image
    image = render_function()
            ^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 221, in <lambda>
    render_function = lambda: self._render_card(site_name, title, description)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 256, in _render_card
    self._resized_logo_promise.result(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 241, in _cache_image
    image = render_function()
            ^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 221, in <lambda>
    render_function = lambda: self._render_card(site_name, title, description)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 256, in _render_card
    self._resized_logo_promise.result(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 241, in _cache_image
    image = render_function()
            ^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 221, in <lambda>
    render_function = lambda: self._render_card(site_name, title, description)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 256, in _render_card
    self._resized_logo_promise.result(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 241, in _cache_image
    image = render_function()
            ^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 221, in <lambda>
    render_function = lambda: self._render_card(site_name, title, description)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 256, in _render_card
    self._resized_logo_promise.result(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 241, in _cache_image
    image = render_function()
            ^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 221, in <lambda>
    render_function = lambda: self._render_card(site_name, title, description)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 256, in _render_card
    self._resized_logo_promise.result(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 241, in _cache_image
    image = render_function()
            ^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 221, in <lambda>
    render_function = lambda: self._render_card(site_name, title, description)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 256, in _render_card
    self._resized_logo_promise.result(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 241, in _cache_image
    image = render_function()
            ^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 221, in <lambda>
    render_function = lambda: self._render_card(site_name, title, description)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 256, in _render_card
    self._resized_logo_promise.result(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 241, in _cache_image
    image = render_function()
            ^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 221, in <lambda>
    render_function = lambda: self._render_card(site_name, title, description)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 256, in _render_card
    self._resized_logo_promise.result(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 241, in _cache_image
    image = render_function()
            ^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 221, in <lambda>
    render_function = lambda: self._render_card(site_name, title, description)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 256, in _render_card
    self._resized_logo_promise.result(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 241, in _cache_image
    image = render_function()
            ^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 221, in <lambda>
    render_function = lambda: self._render_card(site_name, title, description)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 256, in _render_card
    self._resized_logo_promise.result(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 241, in _cache_image
    image = render_function()
            ^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 221, in <lambda>
    render_function = lambda: self._render_card(site_name, title, description)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 256, in _render_card
    self._resized_logo_promise.result(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 241, in _cache_image
    image = render_function()
            ^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 221, in <lambda>
    render_function = lambda: self._render_card(site_name, title, description)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 256, in _render_card
    self._resized_logo_promise.result(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 241, in _cache_image
    image = render_function()
            ^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 221, in <lambda>
    render_function = lambda: self._render_card(site_name, title, description)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 256, in _render_card
    self._resized_logo_promise.result(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/docs/.asdf/installs/python/3.12.7/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 387, in _load_resized_logo
    logo = self._load_logo(config)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 436, in _load_logo
    return self._load_logo_svg(path, self.color["text"])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 448, in _load_logo_svg
    svg2png(bytestring = data, write_to = file, scale = 10)
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/cairosvg/__init__.py", line 54, in svg2png
    return surface.PNGSurface.convert(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/cairosvg/surface.py", line 129, in convert
    tree = Tree(
           ^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/cairosvg/parser.py", line 388, in __init__
    if bytestring.startswith(b'\x1f\x8b'):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: startswith first arg must be str or a tuple of str, not bytes

Related links

Reproduction

Steps to reproduce

I was not able to reproduce locally yet, but it happened on both RTD and GHA, starting few hours ago. I suspect another change is causing this, like one of the binary dependencies related to imaging.

Browser

No response

Before submitting

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 17 (12 by maintainers)

Commits related to this issue

Most upvoted comments

CairoSVG might be causing the issue, as 2.8.0 was released 8 hours ago. Thus, you might consider taking this upstream.

Released as part of 9.6.14.

Amateur mistake 🤦‍♂️ Should be fixed in e45972a8c.

Fixed in https://github.com/squidfunk/mkdocs-material/commit/bce053afc3a7199e7b10de710ef1506700953061 – tagged you as a co-author, @kamilkrzyskow! Thanks! @ssbarnea can you confirm that this fixes the issue on your CI runs? If it does, we can quickly issue a new release with the fix before other users run into it.

Minimal reproduction: 9.6.13-cairo28.zip

using CairoSVG 2.8.0 and SVG logo should result in the same behaviour

The hunch seems correct, and the fix seems also to be:

# Create bytestring
data = data.encode(encoding="utf-8")

(as always)

Thanks ✌️ Although, if it weren’t for you mentioning a new 2.8.0 release in https://github.com/squidfunk/mkdocs-material/issues/8215#issuecomment-2873779104 I would likely see the commit date 2 years ago and go crazy looking for a more recent change 😆

The error seems pretty straightforward.

  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/material/plugins/social/plugin.py", line 448, in _load_logo_svg
    svg2png(bytestring = data, write_to = file, scale = 10)
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/cairosvg/__init__.py", line 54, in svg2png
    return surface.PNGSurface.convert(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/cairosvg/surface.py", line 129, in convert
    tree = Tree(
           ^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/als/envs/1998/lib/python3.12/site-packages/cairosvg/parser.py", line 388, in __init__
    if bytestring.startswith(b'\x1f\x8b'):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: startswith first arg must be str or a tuple of str, not bytes

The error implies that the bytestring is instead a normal str. And it is a normal str containing the contents of the svg. https://github.com/squidfunk/mkdocs-material/blob/ca656243deeaf588c6d591a2c24cb57bbe9347d0/material/plugins/social/plugin.py#L441-L448

The conditional was introduced in a commit 2 years ago, but only now is added in the 2.8.0 version. Amusing FOSS situation 😄

And the bytestring is provided by the social plugin svg2png(bytestring = data, write_to = file, scale = 10) So I believe the social plugin needs to assure casting it to a bytestring with str.encode

Simply using CairoSVG 2.8.0 and SVG logo should result in the same behaviour, haven’t tried it myself though ✌️

Thanks for reporting. As you can probably imagine, without a reproduction, this is impossible for us to fix. We did not change anything on plugins for the last 2 months, and on the social plugin for 4 months, since we’re in feature freeze. I understand that it’s an ask, but I’d kindly ask you to try to narrow it down.

Until then, there’s nothing actionable for us , so I’m closing this issue as not reproducible.