104004: Session already closed

session_closed

An operation was attempted on an AI Transport session, view, or encoder that has already been closed. Once closed, these cannot send, receive, or be reopened.

What you should do

Do not reuse a closed session, view, or encoder. Create a new session, and from it a new view or encoder, for any further work. If close is racing an in-flight operation, where the operation was started just as the session began closing, guard your code so it does not act on a session it has already closed.

Why it happens

Sessions, views, and encoders are single-use; closing one is terminal. This error is raised when an operation, such as connect, send, create a view, regenerate, edit, steer, or write, is invoked on an instance that is already closed, or when an operation was awaiting a result that close then discarded.

What you'll see

The error is reported with code 104004 and status 400. The message states which operation was attempted on which closed component, for example unable to send; session is closed, unable to create view; session is closed, or unable to write to encoder; encoder has been closed.