[X] I used the GitHub search to find a similar issue and didn't find it.
[X] I searched the Prefect documentation for this issue.
[X] I checked that this issue is related to Prefect and not one of its dependencies.
Bug summary
Certain string formats in flow run logs that are replicated through the CLI raise errors in rich.
Reproduction
from prefect import flow, get_run_logger
@flow
def a_flow():
get_run_logger().info("[//]")
get_run_logger().info("[/]")
if __name__ == "__main__":
a_flow()
---
prefect flow-run logs <flow run id>
Error
Traceback (most recent call last):
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/site-packages/prefect/cli/_utilities.py", line 42, in wrapper
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/site-packages/prefect/cli/_types.py", line 153, in fn
return asyncio.run(_fn(*args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/site-packages/prefect/cli/flow_run.py", line 309, in logs
app.console.print(
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/site-packages/rich/console.py", line 1674, in print
renderables = self._collect_renderables(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/site-packages/rich/console.py", line 1538, in _collect_renderables
self.render_str(
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/site-packages/rich/console.py", line 1430, in render_str
rich_text = render_markup(
^^^^^^^^^^^^^^
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/site-packages/rich/markup.py", line 167, in render
raise MarkupError(
rich.errors.MarkupError: closing tag '[//]' at position 67 doesn't match any open tag
Traceback (most recent call last):
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/site-packages/prefect/cli/_utilities.py", line 42, in wrapper
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/site-packages/prefect/cli/_types.py", line 153, in fn
return asyncio.run(_fn(*args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/site-packages/prefect/cli/flow_run.py", line 309, in logs
app.console.print(
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/site-packages/rich/console.py", line 1674, in print
renderables = self._collect_renderables(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/site-packages/rich/console.py", line 1538, in _collect_renderables
self.render_str(
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/site-packages/rich/console.py", line 1430, in render_str
rich_text = render_markup(
^^^^^^^^^^^^^^
File "/Users/kevin/anaconda3/envs/prefect3rc/lib/python3.11/site-packages/rich/markup.py", line 174, in render
raise MarkupError(
rich.errors.MarkupError: closing tag '[/]' at position 66 has nothing to close
Versions
Version: 2.19.4
API version: 0.8.4
Python version: 3.11.9
Git commit: 867543a8
Built: Tue, Jun 4, 2024 3:14 PM
OS/Arch: darwin/arm64
Profile: default
Server type: cloud
Additional context
This seems fixable by adding markup=Falsehere but not sure if there are any side effects.
First check
Bug summary
Certain string formats in flow run logs that are replicated through the CLI raise errors in
rich
.Reproduction
Error
Versions
Additional context
This seems fixable by adding
markup=False
here but not sure if there are any side effects.