different-ai/openwork · error · PluginArchRouteFailure
connector_sync_event_not_found
connector_sync_event_not_found
Error message
Connector sync event not found.
What it means
Thrown by getConnectorSyncEventDetail when getConnectorSyncEventRow finds no sync event with the given connectorSyncEventId in the caller's organization. The visibility check on the parent connector instance and serialization never run. Org-scoped, so events from other orgs are indistinguishable from nonexistent ones.
Source
Thrown at ee/apps/den-api/src/routes/org/plugin-system/store.ts:4269
.orderBy(desc(ConnectorSyncEventTable.startedAt), desc(ConnectorSyncEventTable.id))
const filtered: ReturnType<typeof serializeConnectorSyncEvent>[] = []
for (const row of rows) {
const role = await resolvePluginArchResourceRole({ context: input.context, resourceId: row.instance.id, resourceKind: "connector_instance" })
if (!role) continue
if (input.connectorInstanceId && row.event.connectorInstanceId !== input.connectorInstanceId) continue
if (input.connectorTargetId && row.event.connectorTargetId !== input.connectorTargetId) continue
if (input.eventType && row.event.eventType !== input.eventType) continue
if (input.status && row.event.status !== input.status) continue
if (input.q && !`${row.event.externalEventRef ?? ""}\n${row.event.sourceRevisionRef ?? ""}`.toLowerCase().includes(input.q.toLowerCase())) continue
filtered.push(serializeConnectorSyncEvent(row.event))
}
return pageItems(filtered, input.cursor, input.limit)
}
export async function getConnectorSyncEventDetail(context: PluginArchActorContext, connectorSyncEventId: ConnectorSyncEventId) {
const row = await getConnectorSyncEventRow(context.organizationContext.organization.id, connectorSyncEventId)
if (!row) throw new PluginArchRouteFailure(404, "connector_sync_event_not_found", "Connector sync event not found.")
await ensureVisibleConnectorInstance(context, row.connectorInstanceId)
return serializeConnectorSyncEvent(row)
}
export async function retryConnectorSyncEvent(input: { connectorSyncEventId: ConnectorSyncEventId; context: PluginArchActorContext }) {
const row = await getConnectorSyncEventRow(input.context.organizationContext.organization.id, input.connectorSyncEventId)
if (!row) throw new PluginArchRouteFailure(404, "connector_sync_event_not_found", "Connector sync event not found.")
await ensureEditableConnectorInstance(input.context, row.connectorInstanceId)
await db.update(ConnectorSyncEventTable).set({
attemptCount: 0,
completedAt: null,
nextAttemptAt: null,
startedAt: new Date(),
status: "queued",
}).where(eq(ConnectorSyncEventTable.id, row.id))
return { id: row.id }
}
View on GitHub (pinned to 2b7df46e8a)
Solutions
- Re-list sync events for the connector instance to find the current event ID
- Confirm the org context of the caller matches the event's organizationId
- Check whether retention/job cleanup removed the event row
- Fix polling code to handle 404 as terminal state instead of retrying forever
Example fix
// before
const detail = await getConnectorSyncEventDetail(context, eventId) // throws when pruned
// after
const detail = await getConnectorSyncEventDetail(context, eventId).catch((e) =>
isPluginArchRouteFailure(e) && e.code === "connector_sync_event_not_found" ? null : Promise.reject(e))
if (!detail) show("sync record no longer available") Defensive patterns
Strategy: try-catch
Validate before calling
const events = await listConnectorSyncEvents({ context, connectorInstanceId })
if (!events.some((ev) => ev.id === eventId)) throw new Error("sync event unavailable") Type guard
function isSyncEventNotFound(e: unknown): boolean {
return e instanceof PluginArchRouteFailure && e.code === "connector_sync_event_not_found"
} Try / catch
const detail = await getConnectorSyncEventDetail(context, eventId).catch((e) =>
isSyncEventNotFound(e) ? null : Promise.reject(e))
if (!detail) render("This sync record is no longer available.") Prevention
- Poll event lists for fresh IDs instead of reusing old deep-link IDs
- Expect retention pruning: handle 404 as a terminal UI state
- Stop polling when the event 404s rather than looping
- Scope stored event IDs by org so cross-org links never form
When it happens
Trigger: Requesting a sync event detail with an ID that was never created, was pruned/retention-deleted, is mistyped, or belongs to another organization.
Common situations: Deep links to old sync events after log retention cleanup; polling a sync event ID from a failed/rolled-back sync run; sharing links between two orgs' admin consoles.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/e61633da6f2e3ec6.
Report an issue: GitHub.