{"record":{"id":"223bebec532f792d","repo":"hcengineering/platform","slug":"employee-not-found-name","errorCode":null,"errorMessage":"Employee not found: ${name}","messagePattern":"Employee not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/importer/src/huly/huly.ts","lineNumber":559,"sourceCode":"    }\n\n    this.personIdByEmail.set(email, socialId._id)\n\n    return socialId._id\n  }\n\n  private findAccountByName (name: string): AccountUuid {\n    const account = this.accountsByName.get(name)\n    if (account === undefined) {\n      throw new Error(`Account not found: ${name}`)\n    }\n    return account\n  }\n\n  private findEmployeeByName (name: string): Ref<Employee> {\n    const employee = this.employeesByName.get(name)\n    if (employee === undefined) {\n      throw new Error(`Employee not found: ${name}`)\n    }\n    return employee\n  }\n\n  private async processDocumentsRecursively (\n    builder: ImportWorkspaceBuilder,\n    teamspacePath: string,\n    currentPath: string,\n    parentDocPath?: string\n  ): Promise<void> {\n    const docFiles = fs.readdirSync(currentPath).filter((f) => f.endsWith('.md'))\n\n    for (const docFile of docFiles) {\n      const docPath = path.join(currentPath, docFile)\n      const docHeader = this.parser.readYamlHeader(docPath) as HulyDocumentHeader\n\n      if (docHeader.class === undefined) {\n        this.logger.error(`Skipping ${docFile}: not a document`)","sourceCodeStart":541,"sourceCodeEnd":577,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/packages/importer/src/huly/huly.ts#L541-L577","documentation":"findEmployeeByName maps a person name to an Employee reference using the employeesByName map built from the target workspace. Called from author, owner, and controlled-document processing; an unknown name throws because documents require a valid employee for author/owner attribution.","triggerScenarios":"Processing a controlled document (or its template) whose front-matter `author`/`owner` names, or document author fields, do not match any employee in employeesByName — the person is not an employee of the target workspace or the name differs.","commonSituations":"Importing controlled documents into a workspace where the named authors were never onboarded; former employees no longer in the workspace; name spelling/casing/whitespace mismatches between export and target.","solutions":["Verify each named author/owner exists as an Employee in the target workspace","Fix the name in the document front-matter to exactly match an existing employee","Reassign author/owner fields to a current employee in the exported markdown","Re-export after employees are created in the target workspace"],"exampleFix":"// before (doc front-matter)\nauthor: Bob\nowner: Alice\n// after\nauthor: Robert Brown\nowner: Alice Green","handlingStrategy":"validation","validationCode":"const names = docs.flatMap(d => [d.frontMatter.author, d.frontMatter.owner]).filter(Boolean)\nconst missing = [...new Set(names)].filter(n => !employeeNames.has(n))\nif (missing.length) throw new Error(`Missing employees: ${missing.join(', ')}`)","typeGuard":null,"tryCatchPattern":"try {\n  await importer.workspaceData(folder)\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Employee not found:')) {\n    const name = e.message.slice('Employee not found:'.length).trim()\n    console.error(`Onboard or remap employee \"${name}\" before importing controlled documents`)\n  } else throw e\n}","preventionTips":["Ensure every document author/owner is an active employee in the target workspace","Use exact display names in front-matter fields","Remap former employees to current owners in the export","Validate author/owner names against an employee directory before running the import"],"tags":["importer","employee-lookup","controlled-documents"],"backgroundTag":"referenced-entity-not-found","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}