EngramEngramDocs

Exceptions

All SDK exceptions inherit from EngramError and include a human-readable message explaining what to do.

Exception hierarchy

python
from engram.sdk import (
EngramError, # base class
MinerOfflineError, # miner is unreachable
IngestError, # miner rejected the ingest
QueryError, # query failed on the miner
InvalidCIDError, # malformed CID returned
)
ExceptionWhen raisedCommon cause
MinerOfflineErrorConnection refused or timeoutMiner not running — start with python neurons/miner.py
IngestErrorMiner rejected the requestRate limit, low stake, or text too long
QueryErrorQuery failed on the minerStore empty or miner error
InvalidCIDErrorMalformed CID returnedMiner-side bug — check miner logs

Error handling

python
from engram.sdk import EngramClient, MinerOfflineError, IngestError, QueryError
client = EngramClient("http://127.0.0.1:8091")
# Ingest with handling
try:
cid = client.ingest("Some important text")
except MinerOfflineError as e:
print(f"Miner is down: {e}")
# → Can't reach the miner at http://127.0.0.1:8091
# Start it with: python neurons/miner.py
except IngestError as e:
print(f"Ingest rejected: {e}")
# → Slow down — you've sent 12 requests in the last 60s.
# Query with handling
try:
results = client.query("transformers")
except MinerOfflineError:
results = [] # fallback to cache or empty
except QueryError as e:
print(f"Query failed: {e}")
engram docs · v0.1edit on github →