{"record":{"id":"cb6e3d132b699cd8","repo":"hcengineering/platform","slug":"task-type-not-found-for-project-project-name","errorCode":null,"errorMessage":"Task type not found for project: ${project.name}","messagePattern":"Task type not found for project: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/importer/src/importer/importer.ts","lineNumber":857,"sourceCode":"    spaceId: Ref<Project>\n  ): Promise<{ number: number, identifier: string }> {\n    const incResult = await this.client.updateDoc(\n      tracker.class.Project,\n      core.space.Space,\n      spaceId,\n      { $inc: { sequence: 1 } },\n      true\n    )\n    const number = (incResult as any).object.sequence\n    const identifier = `${project.identifier}-${number}`\n    return { number, identifier }\n  }\n\n  private async getIssueKind (project: Project): Promise<TaskType> {\n    const taskKind = project?.type !== undefined ? { parent: project.type } : {}\n    const kind = await this.client.findOne(task.class.TaskType, taskKind)\n    if (kind === undefined) {\n      throw new Error(`Task type not found for project: ${project.name}`)\n    }\n    return kind\n  }\n\n  private async getIssueRank (project: Project, spaceId: Ref<Project>): Promise<string> {\n    const lastIssue = await this.client.findOne<Issue>(\n      tracker.class.Issue,\n      { space: spaceId },\n      { sort: { rank: SortingOrder.Descending } }\n    )\n    return makeRank(lastIssue?.rank, undefined)\n  }\n\n  private async importComments (issueId: Ref<Issue>, comments: ImportComment[], projectId: Ref<Project>): Promise<void> {\n    const sortedComments = comments.sort((a, b) => {\n      const now = Date.now()\n      return (a.date ?? now) - (b.date ?? now)\n    })","sourceCodeStart":839,"sourceCodeEnd":875,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/packages/importer/src/importer/importer.ts#L839-L875","documentation":"getIssueKind resolves the TaskType document for a project: it queries task.class.TaskType filtered by parent = project.type (when the project has a type). If no matching TaskType exists in the workspace, issue creation cannot proceed and this error is thrown with the project's name.","triggerScenarios":"project.type is undefined (query falls back to {} and either finds nothing or an unexpected default), or project.type references a ProjectType whose TaskType children were never created/imported in the target workspace.","commonSituations":"Importing into a workspace where the ProjectType was created without its TaskTypes; target workspace from an older/newer version with different built-in task types; partial import where TaskType creation step failed or was skipped.","solutions":["Ensure the target workspace has TaskTypes registered under the project's type before importing issues (run the task-type seeding/create step first)","Check that project.type is set on the imported Project and matches an existing ProjectType in the workspace","Verify built-in TaskTypes exist (query task.class.TaskType directly) — if missing, re-run workspace initialization","Align importer and server versions so default ProjectType/TaskType definitions match"],"exampleFix":"// before\nconst project = { ...project, type: undefined } // falls into taskKind = {}\n// after\nconst projectType = await client.findOne(core.class.Type, { name: 'Bug Project' })\nconst project = { ...project, type: projectType._id } // TaskTypes seeded under this type\n","handlingStrategy":"validation","validationCode":"async function ensureTaskTypes(client, project) {\n  const kind = await client.findOne(task.class.TaskType,\n    project.type !== undefined ? { parent: project.type } : {})\n  if (kind === undefined) {\n    throw new Error(`Workspace has no TaskType for project type: ${String(project.type)}`)\n  }\n}","typeGuard":"function hasProjectType(p: Project): p is Project & { type: Ref<ProjectType> } {\n  return p.type !== undefined\n}","tryCatchPattern":"try {\n  await importer.importIssues(project, issues)\n} catch (err) {\n  if (err.message.startsWith('Task type not found')) {\n    console.error('Seed TaskTypes in the target workspace before importing:', err.message)\n  } else throw err\n}","preventionTips":["Run workspace/project-type initialization (TaskType creation) before importing issues","Verify project.type is populated on the imported Project","Query task.class.TaskType in the target workspace as a pre-flight check","Keep server and importer versions aligned so built-in task types exist"],"tags":["importer","task-type","missing-configuration"],"backgroundTag":"resource-not-found","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}