Semaphor
Observability

Event Reference

Complete reference for all Semaphor observability event types, payloads, and error codes

This page documents every event type emitted by Semaphor's observability system. Events are delivered both as structured console logs and via webhook destinations. All field names use snake_case in the delivered payload.


Common Event Envelope

Every event shares these base fields:

FieldTypeDescription
event_idstringUnique identifier (UUID)
event_typestringEvent type (e.g., query_failed)
occurred_atstring (ISO 8601)When the event occurred
statusstringfailed or aborted
categorystringEvent category: query, dashboard, token, assistant, or export
componentstringComponent that emitted the event
messagestringHuman-readable summary
request_idstringCorrelation ID for the HTTP request

Actor Context

These fields identify who triggered the action.

FieldTypeDescription
actor_typestringorg_user or tenant_user
actor_idstringThe user's ID (matches org_user_id or tenant_user_id)
org_idstringOrganization ID
project_idstringProject ID
tenant_idstringTenant ID (present for tenant users)
org_user_idstringOrganization user ID
tenant_user_idstringTenant user ID
token_typestringToken type used for authentication (e.g., dashboard, project)

Not all actor fields appear on every event. For example, tenant_id and tenant_user_id are only present when the actor is a tenant user. Events triggered before authentication completes may have no actor context at all.


Resource Context

These fields identify the resource involved in the event.

FieldTypeDescription
dashboard_idstringDashboard ID
card_idstringCard (visual) ID
connection_idstringData connection ID

Error Fields

Every event includes error details.

FieldTypeDescription
error_codestringMachine-readable error category (e.g., sql_error, auth_error)
error_messagestringHuman-readable error description
error_detailsstringAdditional context, may be JSON-encoded

Security Context

Events carry a normalized snapshot of the active security policies at the time of the failure. These fields are only present when the actor had security policies resolved.

FieldTypeDescription
rlsarrayActive row-level security policies
slsobjectActive schema-level security policy
clsarrayActive connection-level security policies

Event Types

Semaphor emits nine event types, each representing a distinct failure or abort condition.

query_failed

Emitted when a SQL query fails during execution. This is typically the most frequent event type and covers syntax errors, connection issues, security policy failures, and more.

Additional fields:

FieldTypeDescription
query_modestringsql (raw SQL) or config (visual builder)
query_textstringThe SQL query that failed (truncated to 16 KB)
query_text_truncatedbooleantrue if the query was truncated
card_typestringChart type (e.g., bar, line, table)
connection_idstringThe data connection used

Error codes:

CodeDescription
sql_errorSQL syntax or execution error from the database
auth_errorAuthentication or authorization failure (HTTP 401)
resource_not_foundReferenced resource does not exist
rcls_errorRow-level security policy evaluation failed
auto_join_errorAutomatic table join could not be resolved
comparison_errorComparison query (e.g., period-over-period) failed
kpi_errorKPI metric calculation failed
decryption_errorConnection credentials could not be decrypted
validation_errorInvalid request parameters (HTTP 400)
internal_errorUnclassified server-side failure

Example payload:

{
  "event_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "event_type": "query_failed",
  "occurred_at": "2025-06-15T14:32:08.123Z",
  "status": "failed",
  "category": "query",
  "component": "query-api",
  "message": "Query execution failed",
  "request_id": "req_8f2a3b4c",
  "org_id": "org_abc123",
  "project_id": "prj_xyz789",
  "dashboard_id": "d_dash001",
  "card_id": "card_q1_revenue",
  "connection_id": "conn_warehouse",
  "actor_type": "tenant_user",
  "actor_id": "tu_jane",
  "org_user_id": null,
  "tenant_user_id": "tu_jane",
  "tenant_id": "tenant_acme",
  "token_type": "dashboard",
  "query_mode": "config",
  "query_text": "SELECT date, SUM(revenue) FROM orders WHERE tenant_id = 'acme' GROUP BY date",
  "card_type": "line",
  "error_code": "sql_error",
  "error_message": "column \"revenue\" does not exist",
  "rls": [
    {
      "connection_id": "conn_warehouse",
      "name": "tenant_filter",
      "params": { "tenant_id": "acme" }
    }
  ]
}

dashboard_load_failed

Emitted when a dashboard template cannot be retrieved. Common causes include invalid dashboard IDs, expired tokens, or authorization failures.

Error codes:

CodeDescription
auth_errorAuthentication or authorization failure
resource_not_foundDashboard does not exist
validation_errorInvalid request parameters
internal_errorUnclassified server-side failure

Example payload:

{
  "event_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
  "event_type": "dashboard_load_failed",
  "occurred_at": "2025-06-15T14:33:12.456Z",
  "status": "failed",
  "category": "dashboard",
  "component": "dashboard-api",
  "message": "Dashboard load failed",
  "request_id": "req_9c3d4e5f",
  "org_id": "org_abc123",
  "project_id": "prj_xyz789",
  "dashboard_id": "d_invalid",
  "actor_type": "tenant_user",
  "actor_id": "tu_jane",
  "tenant_user_id": "tu_jane",
  "tenant_id": "tenant_acme",
  "error_code": "resource_not_found",
  "error_message": "Dashboard not found"
}

token_generation_failed

Emitted when JWT embed token creation fails. Causes include an invalid dashboard secret, a missing tenant, or a security policy resolution error.

Additional fields:

FieldTypeDescription
token_typestringThe token type requested (e.g., dashboard, project)

Example payload:

{
  "event_id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
  "event_type": "token_generation_failed",
  "occurred_at": "2025-06-15T14:34:05.789Z",
  "status": "failed",
  "category": "token",
  "component": "token-api",
  "message": "Token generation failed",
  "request_id": "req_0d4e5f6a",
  "org_id": "org_abc123",
  "project_id": "prj_xyz789",
  "dashboard_id": "d_dash001",
  "token_type": "dashboard",
  "org_user_id": "ou_admin01",
  "error_code": "auth_error",
  "error_message": "Invalid dashboard secret",
  "rls": [
    {
      "name": "tenant_filter",
      "params": { "tenant_id": "acme" }
    }
  ]
}

assistant_request_failed

Emitted when an AI assistant request fails during processing. This covers authentication errors, invalid payloads, and unexpected runtime failures.

Additional fields:

FieldTypeDescription
assistant_idstringAssistant identifier
assistant_profile_idstringAssistant profile ID
assistant_request_idstringRequest ID within the assistant session
conversation_idstringConversation thread ID
providerstringLLM provider (e.g., openai)
model_namestringModel used (e.g., gpt-4o)

Example payload:

{
  "event_id": "d4e5f6a7-b8c9-0123-defa-234567890123",
  "event_type": "assistant_request_failed",
  "occurred_at": "2025-06-15T14:35:22.012Z",
  "status": "failed",
  "category": "assistant",
  "component": "assistant-api",
  "message": "Assistant request failed",
  "request_id": "req_1e5f6a7b",
  "org_id": "org_abc123",
  "project_id": "prj_xyz789",
  "actor_type": "org_user",
  "actor_id": "ou_admin01",
  "org_user_id": "ou_admin01",
  "assistant_id": "asst_data01",
  "assistant_profile_id": "ap_default",
  "assistant_request_id": "areq_f8c2",
  "conversation_id": "conv_91ab",
  "provider": "openai",
  "model_name": "gpt-4o",
  "error_code": "assistant_request_failed",
  "error_message": "Context window exceeded"
}

assistant_request_aborted

Emitted when an assistant request is cancelled by the user or terminated due to a timeout.

This event has a status of aborted and is logged at warn level instead of error.

Uses the same additional fields as assistant_request_failed.

Example payload:

{
  "event_id": "e5f6a7b8-c9d0-1234-efab-345678901234",
  "event_type": "assistant_request_aborted",
  "occurred_at": "2025-06-15T14:36:45.345Z",
  "status": "aborted",
  "category": "assistant",
  "component": "assistant-api",
  "message": "Assistant request aborted",
  "request_id": "req_2f6a7b8c",
  "org_id": "org_abc123",
  "project_id": "prj_xyz789",
  "actor_type": "org_user",
  "actor_id": "ou_admin01",
  "org_user_id": "ou_admin01",
  "assistant_id": "asst_data01",
  "assistant_profile_id": "ap_default",
  "assistant_request_id": "areq_d4e1",
  "conversation_id": "conv_91ab",
  "provider": "openai",
  "model_name": "gpt-4o",
  "error_code": null,
  "error_message": null
}

assistant_tool_failed

Emitted when a tool call within an assistant conversation fails. A tool call is an action the assistant takes on behalf of the user, such as executing a query or generating a chart.

Additional fields:

All fields from assistant_request_failed, plus:

FieldTypeDescription
tool_namestringName of the tool that failed

Example payload:

{
  "event_id": "f6a7b8c9-d0e1-2345-fabc-456789012345",
  "event_type": "assistant_tool_failed",
  "occurred_at": "2025-06-15T14:37:18.678Z",
  "status": "failed",
  "category": "assistant",
  "component": "assistant-api",
  "message": "Assistant tool failed",
  "request_id": "req_3a7b8c9d",
  "org_id": "org_abc123",
  "project_id": "prj_xyz789",
  "actor_type": "org_user",
  "actor_id": "ou_admin01",
  "org_user_id": "ou_admin01",
  "assistant_id": "asst_data01",
  "assistant_profile_id": "ap_default",
  "assistant_request_id": "areq_c3d0",
  "conversation_id": "conv_91ab",
  "provider": "openai",
  "model_name": "gpt-4o",
  "tool_name": "executeQuery",
  "error_code": "tool_execution_failed",
  "error_message": "Query timed out after 30 seconds"
}

assistant_provider_error

Emitted when the LLM provider returns an error or is unreachable. This includes rate limits, service outages, and network timeouts.

Uses the same additional fields as assistant_request_failed.

Example payload:

{
  "event_id": "a7b8c9d0-e1f2-3456-abcd-567890123456",
  "event_type": "assistant_provider_error",
  "occurred_at": "2025-06-15T14:38:05.901Z",
  "status": "failed",
  "category": "assistant",
  "component": "assistant-api",
  "message": "Assistant provider error",
  "request_id": "req_4b8c9d0e",
  "org_id": "org_abc123",
  "project_id": "prj_xyz789",
  "actor_type": "org_user",
  "actor_id": "ou_admin01",
  "org_user_id": "ou_admin01",
  "assistant_id": "asst_data01",
  "assistant_profile_id": "ap_default",
  "assistant_request_id": "areq_b2c9",
  "conversation_id": "conv_91ab",
  "provider": "openai",
  "model_name": "gpt-4o",
  "error_code": "provider_error",
  "error_message": "OpenAI API returned 429: Rate limit exceeded"
}

assistant_dynamic_visual_failed

Emitted when dynamic chart generation falls back or fails entirely. Dynamic visuals are AI-generated chart configurations that render custom visualizations.

Additional fields:

All fields from assistant_request_failed, plus:

FieldTypeDescription
tool_namestringThe dynamic visual tool that failed (e.g., generateDynamicVisual)

Example payload:

{
  "event_id": "b8c9d0e1-f2a3-4567-bcde-678901234567",
  "event_type": "assistant_dynamic_visual_failed",
  "occurred_at": "2025-06-15T14:39:30.234Z",
  "status": "failed",
  "category": "assistant",
  "component": "assistant-api",
  "message": "Assistant dynamic visual generation failed",
  "request_id": "req_5c9d0e1f",
  "org_id": "org_abc123",
  "project_id": "prj_xyz789",
  "actor_type": "org_user",
  "actor_id": "ou_admin01",
  "org_user_id": "ou_admin01",
  "assistant_id": "asst_data01",
  "assistant_profile_id": "ap_default",
  "assistant_request_id": "areq_a1b8",
  "conversation_id": "conv_91ab",
  "provider": "openai",
  "model_name": "gpt-4o",
  "tool_name": "generateDynamicVisual",
  "error_code": "dynamic_visual_fallback",
  "error_message": "Dynamic visual generation fell back (invalid chart configuration)"
}

export_failed

Emitted when a CSV or PDF export fails. Exports can fail at two stages: creation (validating the request) and execution (generating the file).

Additional fields:

FieldTypeDescription
operationstringexport_create or export_execute
card_typestringChart type of the exported card
card_titlestringDisplay title of the exported card

Example payload:

{
  "event_id": "c9d0e1f2-a3b4-5678-cdef-789012345678",
  "event_type": "export_failed",
  "occurred_at": "2025-06-15T14:40:15.567Z",
  "status": "failed",
  "category": "export",
  "component": "exports-api",
  "message": "Export failed",
  "request_id": "req_6d0e1f2a",
  "org_id": "org_abc123",
  "project_id": "prj_xyz789",
  "dashboard_id": "d_dash001",
  "connection_id": "conn_warehouse",
  "actor_type": "tenant_user",
  "actor_id": "tu_jane",
  "tenant_user_id": "tu_jane",
  "tenant_id": "tenant_acme",
  "operation": "export_create",
  "card_type": "table",
  "card_title": "Q1 Revenue by Region",
  "error_code": "validation_error",
  "error_message": "Export would require 1,500,000 rows, exceeding the 1,000,000 row limit"
}

Data Privacy

What is never included

Observability events are designed to aid debugging without exposing sensitive data. The following are never included in event payloads:

  • Raw JWT tokens
  • Database connection strings or passwords
  • AI conversation transcripts or chain-of-thought reasoning
  • Full security policy definitions (only normalized references are included)

Query text is truncated at 16 KB. If truncation occurs, query_text_truncated is set to true.


Structured Log Format

For self-hosted deployments, every event is written to the console as a single-line JSON object. The log output includes two additional fields beyond the webhook payload:

FieldTypeDescription
timestampstring (ISO 8601)Same value as occurred_at
levelstringwarn for aborted events, error for all others

These logs appear in your Docker container output and can be collected by any log aggregation tool (Datadog, Grafana Loki, CloudWatch, etc.).

Example console log line
{"timestamp":"2025-06-15T14:32:08.123Z","level":"error","component":"query-api","category":"query","event":"query_failed","message":"Query execution failed","event_id":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","request_id":"req_8f2a3b4c","org_id":"org_abc123","error_code":"sql_error","error_message":"column \"revenue\" does not exist"}

On this page