Projection Failures

⚠️

causet failures list/get, causet dlq list/retry/ignore, and causet projections doctor shown below are proposed — none have an equivalent in causet-cli today. See CLI Overview for what’s actually shipped.

This page is a reference summary of the projection failure model. For the complete deep-dive, see Projection Failure Handling.


Types of projection failures

Failure typeCauseRecoverable?
Invalid event payloadMissing or null field referenced in derive expressionYes — fix derive expression, replay
Schema mismatchColumn missing from projection table (DDL not applied)Yes — apply DDL, replay
Bad derive expressionType error, null dereferenceYes — fix expression, deploy, replay
Missing projection tableTable not created at deployYes — apply DDL, replay
DB constraint violationPK conflict, unique violation, not-null constraintUsually yes — fix derive or schema
DB timeout / connection failureInfrastructure transient failureYes — auto-retried, usually resolves
Poison eventEvent that always fails this handlerYes (fix handler) or acknowledged loss
IR version mismatchStale IR loaded from cacheYes — clear cache, redeploy

The ProjectionFailure record

type ProjectionFailure = {
  id: string;
  projectionName: string;
  eventId: string;
  eventType: string;
  eventVersion: number;
  handlerName: string;
  errorName: string;
  errorMessage: string;
  stack?: string;
  retryCount: number;
  status: "open" | "retrying" | "resolved" | "ignored";
  occurredAt: string;
  lastRetriedAt?: string;
  deploymentId?: string;
  environment: "local" | "staging" | "production";
};

Query failure records:

# All open failures in production
causet failures list --env production --status open
 
# Failures for a specific projection
causet failures list --projection artist_leaderboard --env production
 
# Failures since a deploy
causet failures list --since-deployment deploy_abc123

Health endpoint

The projection worker exposes health at /actuator/health:

{
  "status": "DEGRADED",
  "components": {
    "projections": {
      "status": "DEGRADED",
      "details": {
        "artist_leaderboard": "DEGRADED",
        "user_concert_history": "UP",
        "show_attendance": "UP"
      }
    }
  }
}
StatusMeaning
UPNo open failures, processing normally
DEGRADEDOpen failures exist, projection may be falling behind
DOWNNo successful event processed within configured threshold

DLQ integration

After exhausting retries, events route to causet.projection-dlq.v1. See Dead Letter Queues for full DLQ documentation.

Quick reference:

# List DLQ messages for a projection
causet dlq list --projection artist_leaderboard --env production
 
# Replay after fixing the handler
causet dlq retry --projection artist_leaderboard --env production
 
# Acknowledge data loss (last resort)
causet dlq ignore --id pfail_01j2abc --reason "..."

Recovery steps

  1. Identify — Check /actuator/health, causet failures list
  2. Examinecauset failures get --id {id} — read errorMessage, handlerName
  3. Diagnose — Match error to root cause table above
  4. Fix — Edit .causet file, recompile, deploy
  5. Validatecauset projections doctor --fail-on-error
  6. Replaycauset dlq retry --projection {name}
  7. Monitor — Watch projection_lag_seconds return to normal
  8. Verify — Query projection, assert correct data

Full recovery runbook: Projection Failure Handling → Recovery runbook.


Key metrics

MetricAlert threshold
projection_failures_totalAny new failure
projection_dlq_totalAny new message
projection_lag_seconds> 30s warning, > 300s critical
projection_upserts_totalSudden drop → investigate