Overview
The Synap SDK uses a structured error hierarchy to distinguish between transient errors (which are automatically retried) and permanent errors (which require your intervention). Understanding this hierarchy is essential for building robust integrations.Error Hierarchy
All Synap errors inherit fromSynapError. The two main branches determine retry behavior:
correlation_id field that uniquely identifies the request. This ID is invaluable for debugging and when contacting Synap support.
The hierarchy below reflects the full public error surface.
AgentUnavailableError is transient (retryable); all others under SynapPermanentError are non-retryable.Transient Errors
Transient errors represent temporary conditions that typically resolve on their own. The SDK automatically retries these errors according to your configured retry policy. You only need to handle them if all retry attempts are exhausted.NetworkTimeoutError
Raised when a network request to Synap Cloud times out before completing.
- Network connectivity issues between your application and Synap Cloud
- DNS resolution failures
- The request exceeded the configured
connectorreadtimeout
RateLimitError
Raised when your application exceeds the rate limit for the Synap API. Includes a
retry_after_seconds field indicating how long to wait before retrying.- Too many requests in a short time window
- Burst traffic exceeding your plan’s rate limit
The SDK’s built-in retry policy respects
retry_after_seconds automatically. If the rate limit is short (a few seconds), the SDK waits and retries without raising the error to your code. The error only surfaces when all retry attempts are exhausted.ServiceUnavailableError
Raised when Synap Cloud is temporarily unavailable due to maintenance, deployment, or an outage.
- Synap Cloud is undergoing maintenance
- A rolling deployment is in progress
- Temporary backend issues
Permanent Errors
Permanent errors indicate problems that will not resolve by retrying. They require changes to your code, configuration, or data.InvalidInputError
Raised when the request contains invalid parameters or data that fails validation.
- Invalid
document_typevalue - Missing required fields
- Parameter values outside valid ranges
- Malformed data in the request body
InvalidInstanceIdError
Raised when the
instance_id provided does not exist or is in an invalid format.- The
instance_iddoes not match theinst_<hex16>format - The instance has been deleted or deactivated
- A typo in the instance ID
InvalidConversationIdError
Raised when the
conversation_id does not exist or cannot be found.- The conversation ID references a conversation that has not been created yet
- The conversation was deleted
- A typo in the conversation ID
AuthenticationError
Raised when the SDK cannot authenticate with Synap Cloud. This is a general authentication failure.
- API key is invalid or revoked
- Credentials file is corrupted or missing
- The instance’s credentials have been rotated without updating the SDK’s stored credentials
CertificateExpiredError
Raised when the mTLS certificate used for gRPC communication has expired. Certificates have a 7-day TTL with a 48-hour grace period.
- The SDK has been offline for longer than the certificate TTL (7 days) plus grace period (48 hours)
- Certificate auto-renewal failed silently in a previous session
Under normal operation, the SDK automatically renews certificates before they expire. This error typically only occurs when the SDK has been offline for an extended period (more than 9 days).
CertificateRenewalError
Raised when the SDK attempts to renew an expiring certificate but the renewal process fails.
- The certificate authority (CA) is unreachable during renewal
- The instance’s certificate binding has been revoked
- An internal error in the renewal process
BootstrapKeyInvalidError
Raised when the bootstrap token is invalid, expired, or has already been consumed.
- The bootstrap token has already been used (tokens are single-use)
- The token has expired (bootstrap tokens have a limited validity window)
- The token is malformed or does not correspond to the given instance
BootstrapError
Raised when the SDK fails to complete initialization — distinct from
BootstrapKeyInvalidError, which is specifically about the token. BootstrapError covers broader initialization failures such as being unable to reach Synap Cloud during the bootstrap sequence.- Synap Cloud is unreachable during the first
initialize()call - An unexpected error occurs during the bootstrapping sequence that isn’t covered by a more specific error
ContextNotFoundError
Raised when a requested context resource does not exist — for example, fetching context for a user or conversation that has no stored memories yet.
- Fetching context for a user or conversation ID that has never ingested any memories
- The memory was deleted before retrieval
SessionExpiredError
Raised when the current session has expired and cannot be resumed. Sessions are time-bounded and must be re-established after expiry.
- The session has been idle beyond its expiry window
- The session was invalidated server-side (e.g., credential rotation)
AgentUnavailableError
Raised when the Synap agent backing the instance is temporarily unavailable. This is a transient error — the SDK will automatically retry.
- The agent process is restarting or being redeployed
- Temporary resource contention on the backend
The SDK automatically retries
AgentUnavailableError according to your configured retry policy. This error only surfaces to your code when all retry attempts are exhausted.ListeningAlreadyActiveError
Raised when you call
listen() on an instance that already has an active listening stream. Only one stream can be active per SDK instance at a time.- Calling
listen()a second time without first callingstop_listening() - Duplicate initialization paths in your application
ListeningNotActiveError
Raised when you call
stop_listening() or another stream operation when no listening stream is currently active.- Calling
stop_listening()beforelisten()has been called - Calling stream operations after the stream has already been stopped
Using correlation_id
Every Synap error includes an optionalcorrelation_id that uniquely identifies the failed request within Synap’s distributed tracing system.
Retry Policy Configuration
The SDK’s built-in retry policy handles transient errors automatically. You can customize the retry behavior throughRetryPolicy in your SDKConfig.
Retry Behavior
The SDK uses exponential backoff with optional jitter:RateLimitError, the SDK respects the retry_after_seconds value instead of the exponential backoff, waiting the exact duration specified by the server.
Disabling Retries
To disable automatic retries entirely (useful for testing or when you implement your own retry logic):Customizing Retryable Errors
By default, only the three transient error types are retried. You can customize this list, though adding permanent errors is generally not recommended.Common Error Handling Patterns
Catch-All with Transient/Permanent Distinction
Per-Operation Error Handling
Initialization Error Handling
Error Reference Table
| Error | Type | Retried | Common Cause | Resolution |
|---|---|---|---|---|
NetworkTimeoutError | Transient | Yes | Network issues, DNS failures | Check connectivity; increase timeouts |
RateLimitError | Transient | Yes | Too many requests | Reduce frequency; upgrade plan |
ServiceUnavailableError | Transient | Yes | Synap Cloud maintenance | Wait and retry; check status page |
AgentUnavailableError | Transient | Yes | Agent restarting or overloaded | SDK retries automatically; queue if exhausted |
InvalidInputError | Permanent | No | Bad request data | Fix input parameters |
InvalidInstanceIdError | Permanent | No | Wrong instance ID | Verify in Dashboard |
InvalidConversationIdError | Permanent | No | Conversation not found | Check conversation exists |
AuthenticationError | Permanent | No | Invalid/revoked credentials | Re-bootstrap or check config |
CertificateExpiredError | Permanent | No | SDK offline too long | Re-bootstrap instance |
CertificateRenewalError | Permanent | No | CA unreachable during renewal | Contact support |
BootstrapKeyInvalidError | Permanent | No | Token consumed or expired | Generate new token in Dashboard |
BootstrapError | Permanent | No | Init failure beyond token issues | Check connectivity; retry initialize() |
ContextNotFoundError | Permanent | No | No memories exist for resource | Treat as empty state; ingest first |
SessionExpiredError | Permanent | No | Session idle or invalidated | Re-initialize SDK |
ListeningAlreadyActiveError | Permanent | No | listen() called twice | Skip; existing stream still active |
ListeningNotActiveError | Permanent | No | stop_listening() with no stream | Safe to ignore |
Next Steps
SDK Configuration
Customize retry policies, timeouts, and other SDK settings.
Initializing the SDK
Set up the SDK with proper error handling from the start.
Support
Contact Synap support with correlation IDs for issue resolution.
FAQ
Common questions about errors and troubleshooting.