Skip to content

Appendix B: Error Codes Reference

This appendix provides a comprehensive reference for all error codes, exceptions, and error handling patterns in the Graph OLAP SDK.

The SDK uses a hierarchical exception system where all exceptions inherit from GraphOLAPError. This enables both catch-all error handling and fine-grained exception handling for specific error types.

GraphOLAPError (base)
├── AuthenticationError (401)
├── PermissionDeniedError (403)
│ └── ForbiddenError (403)
├── NotFoundError (404)
├── ValidationError (422)
├── ConflictError (409)
│ ├── ResourceLockedError
│ ├── ConcurrencyLimitError (429)
│ ├── DependencyError
│ └── InvalidStateError
├── TimeoutError
│ ├── QueryTimeoutError
│ └── AlgorithmTimeoutError
├── RyugraphError
├── AlgorithmNotFoundError
├── AlgorithmFailedError
├── SnapshotFailedError
├── InstanceFailedError
└── ServerError (5xx)
└── ServiceUnavailableError (503)
HTTPError CodeExceptionDescriptionRecovery
401AUTH_REQUIREDAuthenticationErrorMissing or invalid authenticationProvide valid API key
401TOKEN_EXPIREDAuthenticationErrorAPI key has expiredRefresh or regenerate API key
401INVALID_TOKENAuthenticationErrorMalformed or invalid tokenCheck API key format

Example:

from graph_olap.exceptions import AuthenticationError
try:
client = GraphOLAPClient.from_env()
mappings = client.mappings.list()
except AuthenticationError as e:
print(f"Authentication failed: {e}")
print("Check your GRAPH_OLAP_USERNAME environment variable")
HTTPError CodeExceptionDescriptionRecovery
403PERMISSION_DENIEDPermissionDeniedErrorUser lacks permission for operationRequest appropriate role/permissions
403FORBIDDENForbiddenErrorAccess to resource forbiddenCheck required role (e.g., Ops, Admin)
403ROLE_REQUIREDForbiddenErrorOperation requires specific roleContact administrator for role assignment

Example:

from graph_olap.exceptions import ForbiddenError, PermissionDeniedError
try:
# Ops-only endpoint
config = client.ops.get_config()
except ForbiddenError as e:
print(f"Access denied: {e}")
print("This endpoint requires the Ops role")
except PermissionDeniedError as e:
print(f"Permission denied: {e.details}")
HTTPError CodeExceptionDescriptionRecovery
404RESOURCE_NOT_FOUNDNotFoundErrorRequested resource does not existVerify resource ID exists
404MAPPING_NOT_FOUNDNotFoundErrorMapping with given ID not foundCheck mapping ID
404SNAPSHOT_NOT_FOUNDNotFoundErrorSnapshot with given ID not foundCheck snapshot ID
404INSTANCE_NOT_FOUNDNotFoundErrorInstance with given ID not foundCheck instance ID

Example:

from graph_olap.exceptions import NotFoundError
try:
mapping = client.mappings.get(mapping_id=999)
except NotFoundError as e:
print(f"Mapping not found: {e}")
# List available mappings
mappings = client.mappings.list()
print(f"Available mappings: {[m.id for m in mappings]}")
HTTPError CodeExceptionDescriptionRecovery
422VALIDATION_FAILEDValidationErrorRequest validation failedFix request parameters per error details
422INVALID_MAPPINGValidationErrorInvalid mapping configurationCheck mapping YAML/JSON syntax
422INVALID_CYPHERValidationErrorInvalid Cypher query syntaxFix Cypher query

Example:

from graph_olap.exceptions import ValidationError
try:
snapshot = client.snapshots.create(
mapping_id=1,
name="", # Invalid: empty name
)
except ValidationError as e:
print(f"Validation error: {e}")
print(f"Details: {e.details}")
# Details might contain: {"field": "name", "message": "Name cannot be empty"}
HTTPError CodeExceptionDescriptionRecovery
409RESOURCE_LOCKEDResourceLockedErrorResource is locked by another operationWait for lock release, then retry
409DEPENDENCY_EXISTSDependencyErrorResource has dependencies preventing deletionDelete dependent resources first
409INVALID_STATEInvalidStateErrorOperation invalid for current stateWait for correct state or check workflow
429CONCURRENCY_LIMITConcurrencyLimitErrorToo many concurrent instancesTerminate unused instances, then retry

ResourceLockedError Example:

from graph_olap.exceptions import ResourceLockedError
import time
try:
result = conn.algo.pagerank("Customer", "pr_score")
except ResourceLockedError as e:
print(f"Instance locked by: {e.holder_name}")
print(f"Running algorithm: {e.algorithm}")
# Wait and retry
time.sleep(30)
result = conn.algo.pagerank("Customer", "pr_score")

ConcurrencyLimitError Example:

from graph_olap.exceptions import ConcurrencyLimitError
try:
instance = client.instances.create_from_mapping_and_wait(
mapping_id=1,
name="New Instance",
wrapper_type=WrapperType.RYUGRAPH,
)
except ConcurrencyLimitError as e:
print(f"Limit type: {e.limit_type}") # 'user' or 'global'
print(f"Current: {e.current_count} / Max: {e.max_allowed}")
# Terminate unused instances
instances = client.instances.list()
for inst in instances:
if inst.status == "running" and inst.name.startswith("temp-"):
client.instances.terminate(inst.id)
HTTPError CodeExceptionDescriptionRecovery
408QUERY_TIMEOUTQueryTimeoutErrorCypher query exceeded timeoutOptimize query or increase timeout
408ALGORITHM_TIMEOUTAlgorithmTimeoutErrorAlgorithm execution exceeded timeoutUse smaller dataset or increase timeout
504GATEWAY_TIMEOUTTimeoutErrorGateway timeoutRetry with exponential backoff

Example:

from graph_olap.exceptions import QueryTimeoutError, AlgorithmTimeoutError
try:
# Complex query might timeout
result = conn.query(
"MATCH (a)-[*1..10]->(b) RETURN count(*)",
timeout=60
)
except QueryTimeoutError as e:
print(f"Query timed out: {e}")
print("Consider adding query limits or indexes")
try:
# Algorithm on large graph
exec_result = conn.algo.pagerank(
"Customer",
"pr_score",
timeout=600
)
except AlgorithmTimeoutError as e:
print(f"Algorithm timed out: {e}")
print("Consider sampling or running on smaller subgraph")
HTTPError CodeExceptionDescriptionRecovery
404ALGORITHM_NOT_FOUNDAlgorithmNotFoundErrorUnknown algorithm nameCheck available algorithms via .algorithms()
500ALGORITHM_FAILEDAlgorithmFailedErrorAlgorithm execution failedCheck error message, verify parameters
500RYUGRAPH_ERRORRyugraphErrorDatabase engine errorCheck Cypher syntax, verify graph state

Example:

from graph_olap.exceptions import (
AlgorithmNotFoundError,
AlgorithmFailedError,
RyugraphError
)
try:
result = conn.algo.run("unknown_algo", node_label="Customer")
except AlgorithmNotFoundError as e:
print(f"Algorithm not found: {e}")
# List available algorithms
algos = conn.algo.algorithms()
print(f"Available: {[a['name'] for a in algos]}")
try:
result = conn.algo.pagerank("NonExistentLabel", "pr_score")
except AlgorithmFailedError as e:
print(f"Algorithm failed: {e}")
except RyugraphError as e:
print(f"Database error: {e}")
print(f"Details: {e.details}")
HTTPError CodeExceptionDescriptionRecovery
500SNAPSHOT_FAILEDSnapshotFailedErrorSnapshot export failedCheck Starburst connectivity, retry
500INSTANCE_FAILEDInstanceFailedErrorInstance startup failedCheck logs, verify resources, retry

Example:

from graph_olap.exceptions import SnapshotFailedError, InstanceFailedError
# Recommended: create_from_mapping_and_wait handles both snapshot and instance creation
# It will raise SnapshotFailedError if the internal snapshot export fails
# or InstanceFailedError if the instance startup fails
try:
instance = client.instances.create_from_mapping_and_wait(
mapping_id=1,
name="Graph Instance",
wrapper_type=WrapperType.RYUGRAPH,
)
except SnapshotFailedError as e:
print(f"Snapshot export failed: {e}")
# The internal snapshot failed during export from Starburst
except InstanceFailedError as e:
print(f"Instance startup failed: {e}")
# The instance failed to start (e.g., data loading error)
HTTPError CodeExceptionDescriptionRecovery
500INTERNAL_ERRORServerErrorInternal server errorRetry with backoff, contact support
500STARBURST_ERRORServerErrorStarburst backend errorCheck Starburst cluster status
503SERVICE_UNAVAILABLEServiceUnavailableErrorService temporarily unavailableRetry with exponential backoff

Example:

from graph_olap.exceptions import ServerError, ServiceUnavailableError
import time
def retry_with_backoff(func, max_retries=3):
"""Retry function with exponential backoff."""
for attempt in range(max_retries):
try:
return func()
except ServiceUnavailableError as e:
if attempt == max_retries - 1:
raise
wait_time = 2 ** attempt
print(f"Service unavailable, retrying in {wait_time}s...")
time.sleep(wait_time)
except ServerError as e:
print(f"Server error: {e}")
raise
# Usage
mappings = retry_with_backoff(lambda: client.mappings.list())

Handle all SDK errors with a single handler:

from graph_olap.exceptions import GraphOLAPError
try:
client = GraphOLAPClient.from_env()
# ... operations
except GraphOLAPError as e:
print(f"SDK error: {type(e).__name__}: {e}")
# Log and handle appropriately

Handle specific errors differently:

from graph_olap.exceptions import (
AuthenticationError,
NotFoundError,
ValidationError,
ConcurrencyLimitError,
GraphOLAPError,
)
try:
instance = client.instances.create_from_mapping_and_wait(
mapping_id=mapping_id,
name="Analysis",
wrapper_type=WrapperType.RYUGRAPH,
)
except AuthenticationError:
print("Invalid credentials - check API key")
raise
except NotFoundError:
print(f"Snapshot {snapshot_id} not found")
raise
except ValidationError as e:
print(f"Invalid request: {e.details}")
raise
except ConcurrencyLimitError as e:
print(f"At capacity ({e.current_count}/{e.max_allowed})")
# Could implement auto-cleanup here
raise
except GraphOLAPError as e:
print(f"Unexpected error: {e}")
raise

Use context managers for automatic cleanup:

from graph_olap.exceptions import GraphOLAPError
try:
with GraphOLAPClient.from_env() as client:
# Create instance directly from mapping (snapshot managed internally)
instance = client.instances.create_from_mapping_and_wait(
mapping_id=1,
name="Graph",
wrapper_type=WrapperType.RYUGRAPH,
)
try:
conn = client.instances.connect(instance.id)
result = conn.query("MATCH (n) RETURN count(n)")
finally:
client.instances.terminate(instance.id)
except GraphOLAPError as e:
print(f"Operation failed: {e}")
HTTP StatusException ClassWhen Raised
400ValidationErrorMalformed request
401AuthenticationErrorMissing/invalid authentication
403ForbiddenErrorInsufficient permissions
404NotFoundErrorResource not found
408TimeoutErrorRequest timeout
409ConflictErrorState conflict
422ValidationErrorValidation failed
429ConcurrencyLimitErrorRate/concurrency limit
500ServerErrorInternal server error
503ServiceUnavailableErrorService unavailable
504TimeoutErrorGateway timeout

Many exceptions provide additional context through the details attribute:

from graph_olap.exceptions import ValidationError, ConcurrencyLimitError
try:
# Operation that might fail
pass
except ValidationError as e:
print(f"Message: {e}")
print(f"Details: {e.details}")
# e.details might be: {"field": "name", "constraint": "max_length", "value": 100}
except ConcurrencyLimitError as e:
print(f"Limit type: {e.limit_type}") # 'user' or 'global'
print(f"Current count: {e.current_count}")
print(f"Max allowed: {e.max_allowed}")