different-ai/openwork · error · PluginArchRouteFailure

member_not_found

member_not_found

Error message

Connector creator member not found.

What it means

Thrown when the connector instance's `createdByOrgMembershipId` does not match any active row in MemberTable (query filters `isNull(MemberTable.removedAt)`). The member who created the connector either never existed, was removed from the organization, or the membership id is wrong. Emitted as a 404 PluginArchRouteFailure named member_not_found.

Source

Thrown at ee/apps/den-api/src/routes/org/plugin-system/store.ts:5871

    .where(eq(OrganizationTable.id, input.connectorInstance.organizationId))
    .limit(1)
  const organization = organizationRows[0] as OrganizationRow | undefined
  if (!organization) {
    throw new PluginArchRouteFailure(404, "organization_not_found", "Organization not found for connector instance.")
  }

  const memberRows = await db
    .select()
    .from(MemberTable)
    .where(and(
      eq(MemberTable.organizationId, input.connectorInstance.organizationId),
      eq(MemberTable.id, input.connectorInstance.createdByOrgMembershipId),
      isNull(MemberTable.removedAt),
    ))
    .limit(1)
  const member = memberRows[0] as MemberRow | undefined
  if (!member) {
    throw new PluginArchRouteFailure(404, "member_not_found", "Connector creator member not found.")
  }

  if (!member.userId) {
    throw new PluginArchRouteFailure(404, "member_not_joined", "Connector creator member has not joined the organization.")
  }

  return {
    automation: true,
    memberTeams: [],
    session: null,
    organizationContext: {
      currentMember: {
        createdAt: member.createdAt,
        id: member.id,
        isOwner: roleIncludesOwner(member.role),
        joinedAt: member.joinedAt,
        role: member.role,
        userId: member.userId,

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Re-assign the connector instance to an active membership: update the createdByOrgMembershipId to a current active member.
  2. Confirm the membership row exists and has removedAt IS NULL: SELECT * FROM member WHERE id = '<membershipId>'.
  3. If the creator was removed intentionally, migrate connector ownership in a data migration rather than leaving stale ids.

Example fix

// before
await resolveConnectorActor({ connectorInstanceId }) // creator removed from org -> 404
// after
const activeMember = await db.select().from(MemberTable).where(and(eq(MemberTable.organizationId, orgId), isNull(MemberTable.removedAt))).limit(1)
await db.update(ConnectorInstanceTable).set({ createdByOrgMembershipId: activeMember[0].id }).where(eq(ConnectorInstanceTable.id, connectorInstanceId))
await resolveConnectorActor({ connectorInstanceId })
Defensive patterns

Strategy: validation

Validate before calling

const member = await db.select().from(MemberTable).where(and(eq(MemberTable.id, instance.createdByOrgMembershipId), isNull(MemberTable.removedAt))).limit(1)
if (!member[0]) throw new Error('Creator membership inactive or missing; reassign before resolving')

Type guard

function isActiveMember(row: MemberRow | undefined): row is MemberRow & { removedAt: null } { return row !== undefined && row.removedAt === null }

Try / catch

try {
  await resolveConnectorActor({ connectorInstanceId })
} catch (e) {
  if (e instanceof PluginArchRouteFailure && e.code === 'member_not_found') {
    await reassignConnectorCreator(connectorInstanceId, pickActiveAdminMember())
  } else throw e
}

Prevention

When it happens

Trigger: Resolving a connector instance whose creator membership was soft-removed (removedAt set), whose createdByOrgMembershipId is null/garbage, or resolving after the creator was deleted from the org.

Common situations: A creator left the org or was removed by an admin, breaking automation that still resolves the connector by creator membership; importing data from another environment with mismatched membership ids.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/fe5a670883bef0e2. Report an issue: GitHub.