TUI - when I run script twice there is an unsightly error

When I run script twice there is an unsightly error

image

To be discussed how it should be solved:
Maybe it could be an error message that it was impossible to connect with beekeeper?

latest.log