Error Catalog
Error Catalog
Section titled “Error Catalog”Comprehensive catalog of all platform error codes with causes, examples, and resolution steps.
Table of Contents
Section titled “Table of Contents”- Handler Discovery Errors
- Authentication & Authorization Errors
- Contract Validation Errors
- Message Bus Errors
- Event Store Errors
- Read Model Errors
- CQRS Errors
- Domain Modeling Errors
- Client System Errors
- Service Discovery Errors
- SSE Errors
Handler Discovery Errors
Section titled “Handler Discovery Errors”HANDLER_NOT_FOUND
Section titled “HANDLER_NOT_FOUND”Error Code: HANDLER_NOT_FOUND
Error Message:
No handler registered for message type: CreateUserCommandCause:
- Handler class not discovered during service startup
- Handler not in correct folder (
/commands/,/queries/,/events/) - Missing
@CommandHandler,@QueryHandler, or@EventHandlerdecorator - Handler class not exported from module
Example:
// ❌ WRONG: Missing decoratorexport class CreateUserHandler { async handle(command: CreateUserCommand) { // ... }}
// ✓ CORRECT: With decorator@CommandHandler(CreateUserCommand)export class CreateUserHandler { async handle(command: CreateUserCommand) { // ... }}Solution:
- Ensure handler has correct decorator
- Place handler file in correct folder:
- Commands:
/src/commands/SomethingHandler.ts - Queries:
/src/queries/SomethingHandler.ts - Events:
/src/events/SomethingHandler.ts
- Commands:
- Verify handler is exported:
export class CreateUserHandler - Check service logs for handler discovery messages
Quick Fix:
# Check handler discovery logsgrep "Discovered.*Handler" service.log
# Verify folder structurels -R src/commands src/queries src/eventsRelated:
Authentication & Authorization Errors
Section titled “Authentication & Authorization Errors”AUTHORIZATION_ERROR (Layer 1)
Section titled “AUTHORIZATION_ERROR (Layer 1)”Error Code: AUTHORIZATION_ERROR
Error Message:
Access denied to operation 'CreateUser'. Required permissions: [users:create],User permissions: [users:read]Cause:
- User lacks required permissions at API Gateway level
- JWT token missing required permission claims
- Permission decorator requires permissions user doesn’t have
Example:
@CommandHandler(CreateUserCommand)@RequiresPermissions(['users:create'])export class CreateUserHandler { // User needs 'users:create' permission}Solution:
- Verify user has required permissions in JWT token
- Check permission requirements in handler decorator
- Grant required permissions to user/role in auth service
- Verify permission format matches exactly (case-sensitive)
Quick Fix:
# Decode JWT token to check permissionsecho "YOUR_JWT_TOKEN" | base64 -d | jq '.permissions'
# Check handler permission requirementsgrep "@RequiresPermissions" src/commands/CreateUserHandler.tsPOLICY_VIOLATION (Layer 2)
Section titled “POLICY_VIOLATION (Layer 2)”Error Code: POLICY_VIOLATION
Error Message:
Policy 'OwnershipPolicy' violation for user 'user-123' on operation 'UpdateUser':User can only update their own profileCause:
- User failed policy-based authorization check
- Business rule violation (e.g., editing someone else’s resource)
- Policy logic returned false for current user
Example:
@CommandHandler(UpdateUserCommand)@RequiresPermissions(['users:update'])export class UpdateUserHandler { async handle(command: UpdateUserCommand, context: ExecutionContext) { // Layer 2: Policy check if (command.userId !== context.user.userId && !context.user.isAdmin) { throw new PolicyViolationError( 'OwnershipPolicy', context.user.userId, 'UpdateUser', 'User can only update their own profile' ); } }}Solution:
- Review policy violation reason in error message
- Verify user meets business rule requirements
- Check if user needs admin/special role for operation
- Validate command parameters match user context
Quick Fix:
// Add policy check loggingconsole.log('Policy check:', { userId: context.user.userId, targetUserId: command.userId, isAdmin: context.user.isAdmin});POLICY_AUTH_REQUIRED
Section titled “POLICY_AUTH_REQUIRED”Error Code: POLICY_AUTH_REQUIRED
Error Message:
Authentication required: Operation requires authenticated userCause:
- Handler requires authentication but user is not authenticated
- JWT token missing or invalid
- Anonymous access attempted on protected operation
Solution:
- Include JWT token in request
- Verify token is valid and not expired
- Check if operation allows anonymous access
- Refresh expired token
POLICY_PERMISSION_DENIED
Section titled “POLICY_PERMISSION_DENIED”Error Code: POLICY_PERMISSION_DENIED
Error Message:
Insufficient permissions for UpdateUser.Required: users:update OR users:admin, Actual: users:readCause:
- User lacks any of the required permissions for policy check
- Policy requires at least one permission from list
Solution:
- Grant one of the required permissions to user
- Review policy permission requirements
- Verify permission names match exactly
Contract Validation Errors
Section titled “Contract Validation Errors”CONTRACT_VALIDATION_ERROR
Section titled “CONTRACT_VALIDATION_ERROR”Error Code: CONTRACT_VALIDATION_ERROR
Error Message:
Contract validation failed for service 'user-service': Invalid input schemaCause:
- Contract input/output schema invalid
- Missing required contract fields
- Type definition errors in contract
Example:
// ❌ WRONG: Missing input schemaexport const CreateUserCommand = { messageType: 'CreateUserCommand', // Missing: inputSchema};
// ✓ CORRECT: Complete contractexport const CreateUserCommand = { messageType: 'CreateUserCommand', inputSchema: { email: 'string', password: 'string' }, outputSchema: { userId: 'string' }};Solution:
- Ensure contract has valid
inputSchemaandoutputSchema - Use TypeScript types for compile-time validation
- Verify all required fields present in schema
- Check contract syntax matches platform requirements
Quick Fix:
// Validate contract structureconst contract = { messageType: 'CreateUserCommand', inputSchema: { /* ... */ }, outputSchema: { /* ... */ }, requiredPermissions: ['users:create']};PERMISSION_VALIDATION_ERROR
Section titled “PERMISSION_VALIDATION_ERROR”Error Code: PERMISSION_VALIDATION_ERROR
Error Message:
Invalid permission format: 'users-create' (must use 'resource:action' format)Cause:
- Permission string doesn’t match required format
- Missing colon separator in permission
- Invalid characters in permission string
Solution:
- Use format:
resource:action(e.g.,users:create) - Lowercase resource and action names
- Verify permission names in contract declarations
Quick Fix:
// ❌ WRONG@RequiresPermissions(['users-create', 'USERS:DELETE'])
// ✓ CORRECT@RequiresPermissions(['users:create', 'users:delete'])SCHEMA_GENERATION_ERROR
Section titled “SCHEMA_GENERATION_ERROR”Error Code: SCHEMA_GENERATION_ERROR
Error Message:
Failed to generate GraphQL schema: Duplicate type name 'User'Cause:
- Type name conflicts in schema generation
- Invalid GraphQL type definitions
- Circular type references
Solution:
- Ensure unique type names across contracts
- Check for naming conflicts in domain types
- Review GraphQL schema generation logs
- Use type aliases to resolve conflicts
Message Bus Errors
Section titled “Message Bus Errors”MESSAGE_BUS_ERROR
Section titled “MESSAGE_BUS_ERROR”Error Code: MESSAGE_BUS_ERROR
Error Message:
Message bus operation 'publish' failed: Connection closedCause:
- RabbitMQ connection lost
- Network issues between service and message bus
- Message bus server unavailable
- Connection timeout
Solution:
- Check RabbitMQ server status
- Verify network connectivity
- Review connection configuration
- Check for firewall/proxy issues
- Verify credentials and vhost access
Quick Fix:
# Check RabbitMQ statusdocker ps | grep rabbitmq
# Test connectioncurl http://localhost:15672/api/overview
# Check logsdocker logs rabbitmqCIRCUIT_BREAKER_OPEN
Section titled “CIRCUIT_BREAKER_OPEN”Error Code: CIRCUIT_BREAKER_OPEN
Error Message:
Circuit breaker is open for service 'user-service' after 5 failuresCause:
- Service has failed repeatedly
- Circuit breaker protecting against cascade failures
- Target service unhealthy or unavailable
Solution:
- Wait for circuit breaker to reset (half-open state)
- Fix underlying service issues causing failures
- Check target service health
- Review circuit breaker configuration
Quick Fix:
// Circuit breaker will auto-reset after timeout// Check circuit breaker status in logs[CircuitBreaker] State transition: open -> half-openRelated:
RETRY_EXHAUSTED
Section titled “RETRY_EXHAUSTED”Error Code: RETRY_EXHAUSTED
Error Message:
Operation 'SendEmail' failed after 3 retry attempts: SMTP connection refusedCause:
- All retry attempts failed
- Persistent error condition
- Target service consistently unavailable
Solution:
- Fix underlying error causing failures
- Check target service availability
- Review retry policy configuration
- Investigate root cause of repeated failures
Quick Fix:
// Adjust retry policyconst retryPolicy = { maxAttempts: 5, initialDelayMs: 1000, maxDelayMs: 30000, backoffMultiplier: 2};REQUEST_TIMEOUT
Section titled “REQUEST_TIMEOUT”Error Code: REQUEST_TIMEOUT
Error Message:
Operation 'GetUser' timed out after 5000msCause:
- Target service too slow to respond
- Network latency issues
- Service overloaded
- Timeout configured too low
Solution:
- Increase timeout if operation legitimately slow
- Optimize slow handler logic
- Check service performance metrics
- Review database query performance
Quick Fix:
// Adjust timeoutawait queryBus.execute(new GetUserQuery(userId), { timeout: 10000 // 10 seconds});OPERATION_TIMEOUT
Section titled “OPERATION_TIMEOUT”Error Code: OPERATION_TIMEOUT
Error Message:
query 'GetUserQuery' timed out after 5000msCause:
- Query handler execution too slow
- Database query performance issues
- Network latency to dependencies
- Timeout value too low for operation complexity
Solution:
- Optimize query handler performance
- Add database indexes for query
- Increase timeout for complex operations
- Review query execution plan
Event Store Errors
Section titled “Event Store Errors”EVENT_STORE_ERROR
Section titled “EVENT_STORE_ERROR”Error Code: EVENT_STORE_ERROR
Error Message:
Failed to save aggregate user-123: Database connection lostCause:
- Database connection issues
- Event serialization failures
- Concurrency conflicts
- Database constraints violated
Solution:
- Check PostgreSQL database status
- Verify database connectivity
- Review event data for serialization issues
- Check for concurrent updates to same aggregate
Quick Fix:
# Check PostgreSQL statuspg_isready -h localhost -p 5432
# Check connectionspsql -c "SELECT count(*) FROM pg_stat_activity;"
# Review recent errorstail -f postgresql.logAGGREGATE_CONCURRENCY_ERROR
Section titled “AGGREGATE_CONCURRENCY_ERROR”Error Code: AggregateConcurrencyError
Error Message:
Concurrency conflict for aggregate user-123.Expected version 5, but actual version is 6Cause:
- Multiple commands modifying same aggregate concurrently
- Optimistic locking conflict
- Command executed against stale aggregate version
Example:
// Two concurrent updates to same user// First update succeeds, second fails with concurrency errorawait commandBus.execute(new UpdateUserEmailCommand(userId, 'new1@example.com'));await commandBus.execute(new UpdateUserEmailCommand(userId, 'new2@example.com'));Solution:
- Retry the command to load latest version
- Implement retry logic for concurrency conflicts
- Review command ordering and execution patterns
- Consider using saga for coordinated updates
Quick Fix:
// Auto-retry on concurrency errortry { await commandBus.execute(command);} catch (error) { if (error instanceof AggregateConcurrencyError) { // Reload aggregate and retry await commandBus.execute(command); }}AGGREGATE_NOT_FOUND
Section titled “AGGREGATE_NOT_FOUND”Error Code: AggregateNotFoundError
Error Message:
User with ID user-123 not foundCause:
- Aggregate ID doesn’t exist in event store
- Attempting to load non-existent aggregate
- Typo in aggregate ID
- Aggregate deleted or never created
Solution:
- Verify aggregate ID is correct
- Check if aggregate was created successfully
- Use exists check before loading
- Handle not found case in application logic
Quick Fix:
// Check if aggregate exists firstconst exists = await aggregateAccess.exists(userId);if (!exists) { throw new NotFoundError('User', userId);}
const user = await aggregateAccess.getById(userId);AGGREGATE_OPERATION_ERROR
Section titled “AGGREGATE_OPERATION_ERROR”Error Code: AggregateOperationError
Error Message:
Failed to apply event UserCreated to aggregate user-123Cause:
- Error in event application logic
- Invalid event data
- Event handler throwing exception
- State transition validation failure
Solution:
- Review event handler implementation
- Validate event data structure
- Check business rule violations
- Add error handling in event handlers
Read Model Errors
Section titled “Read Model Errors”ReadModelBase not initialized
Section titled “ReadModelBase not initialized”Error Message:
ReadModelBase not initialized. Call ReadModelBase.initialize() first.Cause:
- Read model base class not initialized with database config
- Missing initialization call during service startup
Solution:
import { ReadModelBase } from '@banyanai/platform-event-sourcing';
// Initialize before using read modelsReadModelBase.initialize(dbConfig, 'my-service');Quick Fix: Add initialization to service startup:
await BaseService.start({ /* ... */ });ReadModelBase.initialize(config.database, config.serviceName);Related:
Projections table not found
Section titled “Projections table not found”Error Message:
Projections table not found in public schema.Ensure PostgresEventStore.initializeSchema() has been called first.Cause:
- Event store schema not initialized
- Database migrations not run
- Wrong database selected
Solution:
// Initialize event store schema BEFORE read modelsconst eventStore = new PostgresEventStore(dbConfig);await eventStore.initializeSchema();
// Then initialize read modelsawait readModelManager.initialize([UserReadModel]);Quick Fix:
-- Manually create projections tableCREATE TABLE IF NOT EXISTS projections ( id TEXT NOT NULL, projection_name TEXT NOT NULL, data JSONB NOT NULL, version INTEGER NOT NULL DEFAULT 1, created_at TIMESTAMP DEFAULT NOW(), updated_at TIMESTAMP DEFAULT NOW(), PRIMARY KEY (id, projection_name));
CREATE INDEX IF NOT EXISTS idx_projections_name ON projections(projection_name);CREATE INDEX IF NOT EXISTS idx_projections_data ON projections USING GIN (data);Failed to persist projection
Section titled “Failed to persist projection”Error Message:
Failed to persist projection user_read_model.email for aggregate user-123:duplicate key value violates unique constraint "idx_user_email"Cause:
- Unique constraint violation
- Duplicate data in projection
- Event replay creating duplicates
Solution:
- Check for duplicate records in projections table
- Review unique indexes on read model
- Ensure projection handlers are idempotent
- Clean up duplicate data before replay
Quick Fix:
-- Find duplicatesSELECT data->>'email', COUNT(*)FROM projectionsWHERE projection_name = 'user_read_model'GROUP BY data->>'email'HAVING COUNT(*) > 1;
-- Remove duplicates (keep newest)DELETE FROM projections p1WHERE projection_name = 'user_read_model' AND EXISTS ( SELECT 1 FROM projections p2 WHERE p2.projection_name = p1.projection_name AND p2.data->>'email' = p1.data->>'email' AND p2.updated_at > p1.updated_at );Related:
CQRS Errors
Section titled “CQRS Errors”VALIDATION_ERROR
Section titled “VALIDATION_ERROR”Error Code: VALIDATION_ERROR (CQRS)
Error Message:
Validation failed for fields: email, passwordCause:
- Command or query input validation failed
- Required fields missing
- Field values don’t meet constraints
Example:
// Validation error with field detailsthrow new CQRSValidationError( 'Validation failed', correlationId, [ { field: 'email', message: 'Invalid email format', value: 'not-an-email' }, { field: 'password', message: 'Password too short', value: '123' } ]);Solution:
- Verify all required fields provided
- Check field value constraints
- Review validation rules in handler
- Ensure input data types match schema
Quick Fix:
// Client-side validation before sendingfunction validateCreateUser(input: CreateUserInput) { const errors = [];
if (!input.email || !input.email.includes('@')) { errors.push({ field: 'email', message: 'Valid email required' }); }
if (!input.password || input.password.length < 8) { errors.push({ field: 'password', message: 'Password must be at least 8 characters' }); }
return errors;}UNKNOWN_ERROR
Section titled “UNKNOWN_ERROR”Error Code: UNKNOWN_ERROR
Error Message:
An unknown error occurredCause:
- Unexpected exception in handler
- Unhandled error type
- Error not properly wrapped
Solution:
- Check service logs for full error details
- Add proper error handling in handler
- Wrap errors in domain-specific error types
- Review stack trace for root cause
Domain Modeling Errors
Section titled “Domain Modeling Errors”DOMAIN_ERROR
Section titled “DOMAIN_ERROR”Error Message:
Cannot send invoice with no line itemsCause:
- Business rule violation in domain logic
- Invalid state transition
- Precondition not met
Example:
@AggregateRoot()class Invoice { send() { if (this.lineItems.length === 0) { throw new DomainError('Cannot send invoice with no line items'); }
if (this.status !== 'draft') { throw new DomainError('Can only send draft invoices'); }
// Apply business logic }}Solution:
- Review business rule that was violated
- Ensure aggregate in correct state before operation
- Validate preconditions met
- Check domain invariants
DOMAIN_ASSERTION_FAILED
Section titled “DOMAIN_ASSERTION_FAILED”Error Code: DOMAIN_ASSERTION_FAILED
Error Message:
Assertion failed: Amount must be positiveCause:
- Domain assertion check failed
- Invariant violation
- Invalid argument to domain method
Solution:
- Review assertion requirements
- Validate input parameters
- Check domain constraints
- Ensure valid state before operation
Client System Errors
Section titled “Client System Errors”SERVICE_UNAVAILABLE
Section titled “SERVICE_UNAVAILABLE”Error Code: SERVICE_UNAVAILABLE
Error Message:
user-service: Service is currently unavailableCause:
- Target service not running
- Service not registered in service discovery
- Network connectivity issues
- Service in unhealthy state
Solution:
- Check if target service is running
- Verify service discovery registration
- Check service health endpoint
- Review service logs for errors
Quick Fix:
# Check service statusdocker ps | grep user-service
# Check service discoverycurl http://localhost:3001/health
# Restart servicedocker restart user-serviceSERVICE_DEGRADED
Section titled “SERVICE_DEGRADED”Error Code: SERVICE_DEGRADED
Error Message:
user-service: Service is operating in degraded modeCause:
- Service partially functional
- Some dependencies unavailable
- Performance degradation
- Resource constraints
Solution:
- Check service health metrics
- Review dependency status
- Monitor resource usage
- Consider graceful degradation in calling code
CLIENT_GENERATION_FAILED
Section titled “CLIENT_GENERATION_FAILED”Error Code: CLIENT_GENERATION_FAILED
Error Message:
Client generation failed for service 'user-service' at step 'type-generation':Invalid type definitionCause:
- Contract type definitions invalid
- Code generation errors
- TypeScript compilation failures
Solution:
- Review contract definitions
- Check type generation logs
- Validate TypeScript syntax
- Ensure all types properly exported
CONTRACT_VIOLATION
Section titled “CONTRACT_VIOLATION”Error Code: CONTRACT_VIOLATION
Error Message:
Contract violation in operation 'CreateUser':Response missing required field 'userId'Cause:
- Handler returned data not matching output schema
- Missing required fields in response
- Type mismatch between handler and contract
Solution:
- Verify handler return type matches output schema
- Ensure all required fields included in response
- Check contract definition accuracy
- Add runtime validation in handler
Quick Fix:
// Ensure response matches contract@CommandHandler(CreateUserCommand)export class CreateUserHandler { async handle(command: CreateUserCommand): Promise<CreateUserResult> { const userId = await this.createUser(command);
// ✓ Return matches output schema return { userId, // Required field email: command.email }; }}CORRELATION_CONTEXT_MISSING
Section titled “CORRELATION_CONTEXT_MISSING”Error Code: CORRELATION_CONTEXT_MISSING
Error Message:
Correlation context not available for operation 'CreateUser'Cause:
- AsyncLocalStorage context not set
- Context lost during async operation
- Missing context propagation
Solution:
- Ensure operation called within async context
- Check context propagation through async boundaries
- Verify BaseService initialized correctly
- Review async middleware setup
Service Discovery Errors
Section titled “Service Discovery Errors”SERVICE_NOT_REGISTERED
Section titled “SERVICE_NOT_REGISTERED”Error Message:
Service 'user-service' not found in service discoveryCause:
- Service not started
- Service discovery registration failed
- Service name mismatch
- Service crashed before registration
Solution:
- Start the service
- Check service discovery logs
- Verify service name configuration
- Review service health checks
Quick Fix:
# Check registered servicescurl http://localhost:3001/api/services | jq '.services[].name'
# Restart service to re-registerdocker restart user-serviceCONTRACT_NOT_FOUND
Section titled “CONTRACT_NOT_FOUND”Error Message:
No contracts found for service 'user-service'Cause:
- Service started but contracts not broadcast
- Contract registration failed
- Service discovery not receiving contracts
Solution:
- Check service logs for contract broadcasting
- Verify message bus connectivity
- Ensure contracts properly exported
- Review service discovery subscription
SSE Errors
Section titled “SSE Errors”SSE_CONNECTION_UNAUTHORIZED
Section titled “SSE_CONNECTION_UNAUTHORIZED”HTTP Status: 401 Unauthorized
Error Message:
{ "error": "Unauthorized", "message": "Authentication required for SSE connection"}Cause:
- No JWT token provided
- Invalid JWT token
- Token expired
Solution:
- Include JWT token in request:
- Query param:
?token=YOUR_JWT_TOKEN - Header:
Authorization: Bearer YOUR_JWT_TOKEN
- Query param:
- Refresh expired token
- Verify token format and signature
Quick Fix:
// Include token in connectionconst token = localStorage.getItem('jwt');const eventSource = new EventSource(`/api/events?token=${token}`);SSE_CONNECTION_FORBIDDEN
Section titled “SSE_CONNECTION_FORBIDDEN”HTTP Status: 403 Forbidden
Error Message:
{ "error": "Forbidden", "message": "Insufficient permissions for requested event types", "deniedEvents": ["AdminEvent", "SystemEvent"]}Cause:
- User lacks permissions for requested event types
- Subscription to protected events without authorization
Solution:
- Subscribe to events user has permissions for
- Grant required permissions to user
- Filter event types based on user permissions
Quick Fix:
// Subscribe only to allowed eventsconst eventSource = new EventSource( `/api/events?token=${token}&events=UserCreated,OrderPlaced`);SSE_CONNECTION_LIMIT
Section titled “SSE_CONNECTION_LIMIT”HTTP Status: 503 Service Unavailable
Error Message:
{ "error": "Service Unavailable", "message": "Connection limit exceeded. Please close existing connections."}Cause:
- User exceeded maximum concurrent connections (default: 5)
- Browser tabs with open SSE connections
- Connections not properly closed
Solution:
- Close unused SSE connections
- Implement proper cleanup on page unload
- Limit connections per user session
- Configure higher connection limit if needed
Quick Fix:
// Close connection on page unloadwindow.addEventListener('beforeunload', () => { eventSource.close();});
// Track and limit connectionsconst connections = new Set();function createSSE() { if (connections.size >= 3) { console.warn('Maximum connections reached'); return; }
const es = new EventSource('/api/events'); connections.add(es);
es.addEventListener('close', () => { connections.delete(es); });}Error Handling Best Practices
Section titled “Error Handling Best Practices”1. Always Include Correlation ID
Section titled “1. Always Include Correlation ID”import { getCorrelationId } from '@banyanai/platform-core';
try { await commandBus.execute(command);} catch (error) { const correlationId = getCorrelationId(error) || 'unknown'; console.error(`Error processing command [${correlationId}]:`, error);}2. Wrap External Errors
Section titled “2. Wrap External Errors”try { await externalApi.call();} catch (error) { throw new RemoteOperationError( 'Failed to call external API', correlationId, 'external-service', error );}3. Log Context with Errors
Section titled “3. Log Context with Errors”catch (error) { Logger.error('Command execution failed', error, { commandType: command.constructor.name, userId: context.user.userId, correlationId: context.correlationId, timestamp: new Date().toISOString() });}4. Return Appropriate HTTP Status
Section titled “4. Return Appropriate HTTP Status”// In API Gateway error handlerif (error instanceof CQRSValidationError) { return { status: 400, body: { error: 'Validation failed', details: error.validationErrors } };}
if (error instanceof CQRSAuthorizationError) { return { status: 403, body: { error: 'Access denied' } };}
if (error instanceof NotFoundError) { return { status: 404, body: { error: 'Resource not found' } };}
// Default to 500 for unexpected errorsreturn { status: 500, body: { error: 'Internal server error' } };5. Implement Retry Logic for Transient Errors
Section titled “5. Implement Retry Logic for Transient Errors”import { RetryManager } from '@banyanai/platform-message-bus-client';
const retryManager = new RetryManager({ maxAttempts: 3, initialDelayMs: 1000, maxDelayMs: 10000, backoffMultiplier: 2});
await retryManager.executeWithRetry( async () => await messageBus.publish(event), { operation: 'publishEvent', serviceName: 'user-service', correlationId });Error Code Quick Reference
Section titled “Error Code Quick Reference”| Code | Category | Severity | Action |
|---|---|---|---|
HANDLER_NOT_FOUND | Discovery | Error | Check handler registration |
AUTHORIZATION_ERROR | Auth | Error | Grant permissions |
POLICY_VIOLATION | Auth | Error | Review business rules |
VALIDATION_ERROR | Input | Error | Fix input data |
CONTRACT_VALIDATION_ERROR | Contract | Error | Fix contract definition |
MESSAGE_BUS_ERROR | Infrastructure | Error | Check RabbitMQ |
CIRCUIT_BREAKER_OPEN | Resilience | Warning | Wait or fix service |
RETRY_EXHAUSTED | Resilience | Error | Fix underlying issue |
REQUEST_TIMEOUT | Performance | Error | Optimize or increase timeout |
EVENT_STORE_ERROR | Storage | Error | Check PostgreSQL |
AGGREGATE_CONCURRENCY_ERROR | Concurrency | Warning | Retry operation |
AGGREGATE_NOT_FOUND | Data | Error | Verify ID exists |
SERVICE_UNAVAILABLE | Discovery | Error | Start service |
SERVICE_DEGRADED | Health | Warning | Monitor service |
DOMAIN_ERROR | Business Logic | Error | Check business rules |
Related Documentation
Section titled “Related Documentation”Getting Help
Section titled “Getting Help”If you encounter an error not listed here:
- Check service logs for detailed error messages and stack traces
- Search codebase for error message
- Review related component documentation
- Check issue tracker for similar errors
- File a detailed bug report with:
- Error message and code
- Steps to reproduce
- Service logs
- Configuration details
- Expected vs actual behavior