Queries & Relationships
Errors from the queries: block’s runtime contract, and from relationships: definitions.
6 error codes in this section.
Query Runtime-Contract
VERR_QUERY_WINDOW_ALLOWED_INVALID
window.allowed value has invalid format or misaligned bucket. A window.allowed value is not a recognised interval format, or is not a whole multiple of the projection’s bucket interval.
Impact: Queries for that window return empty or stale results.
# projection bucket.interval: 1h
window:
allowed: [5m, 1h] # 5m not a multiple of 1hwindow:
allowed: [1h, 2h, 24h] # all multiples of 1hVERR_QUERY_WINDOW_VALUE_INVALID
window.allowed contains unsupported runtime value. A window.allowed value is not in the set the query-service runtime actually supports: 1h, 24h, 7d. Unsupported values are silently ignored, returning empty results for those windows.
Impact: Frontend receives no data for the unsupported window; silent user-facing failure.
window:
allowed: [30m, 1h, 24h, 7d] # 30m not supported by runtimewindow:
allowed: [1h, 24h, 7d] # supported runtime values onlyVERR_QUERY_INPUT_PARAM_UNDECLARED
Query references undeclared input parameter. A WHERE clause or limit_input references input.X but X is not declared in the query’s input: block. Runtime silently passes null, returning no rows or performing a full table scan.
Impact: Query silently returns empty results or scans the full table.
where:
venue_id:
eq: "input.venue_id" # venue_id not in input:
input:
limit: { type: integer }where:
venue_id:
eq: "input.venue_id"
input:
venue_id: { type: string, required: true }
limit: { type: integer }VERR_QUERY_OPERATOR_TYPE_MISMATCH
Query WHERE operator incompatible with column type. A WHERE operator is incompatible with the column’s declared type. Geo operators (within_radius, within_box, distance_lte) require GEOGRAPHY_POINT; text operators (contains, starts_with, ilike, like) require TEXT or STRING.
Impact: Query fails at runtime with a Postgres type error.
# venue_id is TEXT
where:
venue_id:
within_radius: # geo op on TEXT field
center: "input.point"
radius_m: 1000# Use a GEOGRAPHY_POINT field for geo operators:
# fields.location: GEOGRAPHY_POINT
where:
location:
within_radius:
center: "input.point"
radius_m: 1000Relationships
VERR_RELATIONSHIP_STREAM_NOT_FOUND
Relationship from/to state not found. A relationship’s from: or to: value does not match any state defined in the spec. The generated relationship stream references an entity that does not exist.
Impact: Relationship stream cannot be generated; emit events are dead.
relationships:
user_follows_venue:
from: user # not in state:
to: venue # not in state:
cardinality: many_to_manystate:
user: { ... }
venue: { ... }
relationships:
user_follows_venue:
from: user
to: venue
cardinality: many_to_manyVERR_RELATIONSHIP_EMIT_EVENT_DUPLICATE
Duplicate emit_events name across relationships. Two or more relationships declare the same event name in their emit_events block. Duplicate names cause the projection worker to route events to multiple relationship streams simultaneously, producing phantom rows.
Impact: Both relationships receive every instance of the event; rows are duplicated.
relationships:
user_follows_venue:
emit_events:
created: UserFollowedVenue
user_bookmarks_venue:
emit_events:
created: UserFollowedVenue # duplicate!relationships:
user_follows_venue:
emit_events:
created: UserFollowedVenue
user_bookmarks_venue:
emit_events:
created: UserBookmarkedVenue # unique name