Skip to main content

Disconnect

Closes an existing Stability AI connection and releases resources.

Common Properties​

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs​

  • Connection Id - The connection ID from the Connect node to close. This ID is used to identify which Stability AI session to terminate.

How It Works​

The Disconnect node is the final step in any Stability AI automation flow. It properly cleans up the connection session and removes stored credentials from memory.

When executed, the node:

  1. Validates the provided Connection Id
  2. Retrieves the stored API key associated with the connection
  3. Removes the connection from the session manager
  4. Frees up memory resources

Requirements​

  • A valid Connection Id from a previously executed Connect node
  • The Connect node must have run successfully before Disconnect

Error Handling​

The node will return specific errors in the following cases:

  • Empty or invalid Connection Id
  • Connection not found (e.g., if the Connect node didn't execute successfully or the connection was already disconnected)

Usage Notes​

  • Always place a Disconnect node at the end of your Stability AI flow
  • The Disconnect node ensures proper cleanup of credentials from memory
  • It's a good practice to use Disconnect even if the flow encounters errors
  • If a flow stops unexpectedly, the connection will be automatically cleaned up when the flow terminates
  • You cannot reuse a Connection Id after it has been disconnected

Best Practices​

  • Always pair each Connect node with a corresponding Disconnect node
  • Place the Disconnect node after all Stability AI operations are complete
  • Consider using a Try-Catch-Finally pattern where Disconnect is in the Finally block to ensure cleanup even on errors
  • Don't share Connection Ids between different flow executions
  • If you need to perform multiple batches of operations, keep the connection open throughout and disconnect only at the very end

Example Flow​

Basic Flow with Cleanup:

Connect
→ GetUserCredit (check balance)
→ TextToImages (generate images)
→ Disconnect (cleanup)

Flow with Error Handling:

Try:
Connect
→ TextToImages (generate images)
→ ImageToImages (modify images)
Catch:
(handle errors)
Finally:
Disconnect (always cleanup)

Multiple Operations Flow:

Connect
→ Loop Start
→ TextToImages (generate batch)
→ Upscale (enhance quality)
→ Loop End
→ Disconnect (cleanup after all batches)

Security Considerations​

  • The Disconnect node removes API credentials from memory
  • This prevents credentials from lingering in the session after use
  • Always disconnect to follow security best practices
  • Even though connections auto-cleanup on flow termination, explicit disconnection is recommended