{"record":{"id":"999db7099af66d4c","repo":"hcengineering/platform","slug":"no-owner-type-found-for-entitytype","errorCode":null,"errorMessage":"No owner type found for ${entityType}","messagePattern":"No owner type found for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/bitrix/src/sync.ts","lineNumber":778,"sourceCode":"    space: Ref<Space> | undefined\n    mapping: WithLookup<BitrixEntityMapping>\n    limit: number\n    direction: 'ASC' | 'DSC'\n    frontUrl: string\n    loginInfo: LoginInfo\n    monitor: (total: number) => void\n    blobProvider?: ((blobRef: { file: string, id: string }) => Promise<Blob | undefined>) | undefined\n    syncComments?: boolean\n    syncEmails?: boolean\n  },\n  commentFieldKeys: string[],\n  userList: Map<string, PersonId>,\n  ownerTypeValues: BitrixOwnerType[]\n): Promise<void> {\n  const entityType = ops.mapping.type.replace('crm.', '')\n  const ownerType = ownerTypeValues.find((it) => it.SYMBOL_CODE.toLowerCase() === entityType)\n  if (ownerType === undefined) {\n    throw new Error(`No owner type found for ${entityType}`)\n  }\n  if (ops.syncComments ?? true) {\n    const commentsData = await ops.bitrixClient.call(BitrixEntityType.Comment + '.list', {\n      filter: {\n        ENTITY_ID: res.document.bitrixId,\n        ENTITY_TYPE: entityType\n      },\n      select: commentFieldKeys,\n      order: { ID: ops.direction }\n    })\n    for (const it of commentsData.result) {\n      const c: ChatMessage & BitrixSyncDoc = {\n        _id: generateId(),\n        _class: chunter.class.ChatMessage,\n        message: processComment(it.COMMENT as string),\n        bitrixId: `${it.ID as string}`,\n        type: it.ENTITY_TYPE,\n        attachedTo: res.document._id,","sourceCodeStart":760,"sourceCodeEnd":796,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/plugins/bitrix/src/sync.ts#L760-L796","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add the missing owner type (with correct SYMBOL_CODE matching the entityType) to the sync configuration ownerTypeValues","Verify ops.mapping.type in the sync mapping matches a supported Bitrix CRM entity (lead, deal, contact, company)","Update the integration to a version supporting the new Bitrix entity type"],"exampleFix":"// before\nmapping: { type: 'crm.smartInvoice' } // no matching SYMBOL_CODE\n// after: either map a supported type\nmapping: { type: 'crm.deal' }\n// or register the owner type with SYMBOL_CODE: 'smartInvoice'","handlingStrategy":"validation","validationCode":"const entityType = ops.mapping.type.replace('crm.', '')\nconst known = ownerTypeValues.some(it => it.SYMBOL_CODE.toLowerCase() === entityType)\nif (!known) throw new Error(`Configure owner type for ${entityType} before sync`)","typeGuard":"const hasOwnerType = (t: string, types: BitrixOwnerType[]): t is string =>\n  types.some(it => it.SYMBOL_CODE.toLowerCase() === t.replace('crm.', ''))","tryCatchPattern":"try {\n  await downloadComments(...)\n} catch (err) {\n  if ((err as Error).message.startsWith('No owner type found for')) {\n    logger.warn('Skipping unmapped Bitrix entity type', { type: (err as Error).message })\n  } else throw err\n}","preventionTips":["Keep ownerTypeValues config in sync with all Bitrix CRM entity types in use","Validate sync mappings against SYMBOL_CODEs at config load time","Test sync after Bitrix upgrades that may introduce new entity kinds"],"tags":["sync","configuration","bitrix"],"backgroundTag":"unmapped-entity-type","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}