hcengineering/platform · error

No owner type found for ${entityType}

Error message

No owner type found for ${entityType}

What it means

During comment download, the Bitrix entity type from the ops mapping (e.g. 'lead', 'deal' with the 'crm.' prefix stripped) is matched against the configured list of BitrixOwnerType values by SYMBOL_CODE. If no configured owner type matches, sync cannot proceed and this error is thrown.

Source

Thrown at plugins/bitrix/src/sync.ts:778

    space: Ref<Space> | undefined
    mapping: WithLookup<BitrixEntityMapping>
    limit: number
    direction: 'ASC' | 'DSC'
    frontUrl: string
    loginInfo: LoginInfo
    monitor: (total: number) => void
    blobProvider?: ((blobRef: { file: string, id: string }) => Promise<Blob | undefined>) | undefined
    syncComments?: boolean
    syncEmails?: boolean
  },
  commentFieldKeys: string[],
  userList: Map<string, PersonId>,
  ownerTypeValues: BitrixOwnerType[]
): Promise<void> {
  const entityType = ops.mapping.type.replace('crm.', '')
  const ownerType = ownerTypeValues.find((it) => it.SYMBOL_CODE.toLowerCase() === entityType)
  if (ownerType === undefined) {
    throw new Error(`No owner type found for ${entityType}`)
  }
  if (ops.syncComments ?? true) {
    const commentsData = await ops.bitrixClient.call(BitrixEntityType.Comment + '.list', {
      filter: {
        ENTITY_ID: res.document.bitrixId,
        ENTITY_TYPE: entityType
      },
      select: commentFieldKeys,
      order: { ID: ops.direction }
    })
    for (const it of commentsData.result) {
      const c: ChatMessage & BitrixSyncDoc = {
        _id: generateId(),
        _class: chunter.class.ChatMessage,
        message: processComment(it.COMMENT as string),
        bitrixId: `${it.ID as string}`,
        type: it.ENTITY_TYPE,
        attachedTo: res.document._id,

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Add the missing owner type (with correct SYMBOL_CODE matching the entityType) to the sync configuration ownerTypeValues
  2. Verify ops.mapping.type in the sync mapping matches a supported Bitrix CRM entity (lead, deal, contact, company)
  3. Update the integration to a version supporting the new Bitrix entity type

Example fix

// before
mapping: { type: 'crm.smartInvoice' } // no matching SYMBOL_CODE
// after: either map a supported type
mapping: { type: 'crm.deal' }
// or register the owner type with SYMBOL_CODE: 'smartInvoice'
Defensive patterns

Strategy: validation

Validate before calling

const entityType = ops.mapping.type.replace('crm.', '')
const known = ownerTypeValues.some(it => it.SYMBOL_CODE.toLowerCase() === entityType)
if (!known) throw new Error(`Configure owner type for ${entityType} before sync`)

Type guard

const hasOwnerType = (t: string, types: BitrixOwnerType[]): t is string =>
  types.some(it => it.SYMBOL_CODE.toLowerCase() === t.replace('crm.', ''))

Try / catch

try {
  await downloadComments(...)
} catch (err) {
  if ((err as Error).message.startsWith('No owner type found for')) {
    logger.warn('Skipping unmapped Bitrix entity type', { type: (err as Error).message })
  } else throw err
}

Prevention

When it happens

Trigger: downloadComments runs with ops.mapping.type like 'crm.sometype' whose suffix is not present (case-insensitively) in ownerTypeValues[].SYMBOL_CODE — typically an unmapped or misspelled Bitrix CRM entity type in the sync mapping config.

Common situations: Bitrix workspace uses a CRM entity type not included in the integration's owner-type configuration; typo in SYMBOL_CODE; Bitrix API returns new entity kinds after an upgrade; mapping config copied from another workspace.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/999db7099af66d4c. Report an issue: GitHub.