{"record":{"id":"2de97d4bd716ddb1","repo":"twentyhq/twenty","slug":"operation-failed-2de97d","errorCode":"OPERATION_FAILED","errorMessage":"Failed to create workflow \"${seed.workflowName}\": no id returned.","messagePattern":"Failed to create workflow \"(.+?)\": no id returned\\.","errorType":"exception","errorClass":"PdlOperationError","httpStatus":null,"severity":"error","filePath":"packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/seed-enrichment-workflow.ts","lineNumber":46,"sourceCode":"    return {\n      objectNameSingular: seed.objectNameSingular,\n      workflowName: seed.workflowName,\n      status: 'skipped',\n      workflowId: existingWorkflowId,\n    };\n  }\n\n  const createResult = (await client.mutation({\n    createWorkflow: {\n      __args: { data: { name: seed.workflowName } },\n      id: true,\n    },\n  })) as { createWorkflow?: { id?: string } };\n\n  const workflowId = createResult.createWorkflow?.id;\n\n  if (!isDefined(workflowId)) {\n    throw new PdlOperationError(\n      `Failed to create workflow \"${seed.workflowName}\": no id returned.`,\n    );\n  }\n\n  const versionsResult = (await client.query({\n    workflowVersions: {\n      __args: { filter: { workflowId: { eq: workflowId } } },\n      edges: { node: { id: true, status: true } },\n    },\n  })) as {\n    workflowVersions?: { edges?: { node?: { id?: string; status?: string } }[] };\n  };\n\n  const draftVersionId = versionsResult.workflowVersions?.edges?.find(\n    (edge) => edge.node?.status === 'DRAFT',\n  )?.node?.id;\n\n  if (!isDefined(draftVersionId)) {","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/twentyhq/twenty/blob/1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6/packages/twenty-apps/public/people-data-labs/src/logic-functions/utils/seed-enrichment-workflow.ts#L28-L64","documentation":"While seeding the PDL enrichment workflow, the code calls `createWorkflow` with a name and expects an `id`. If `createResult.createWorkflow?.id` is undefined it throws a `PdlOperationError` (`OPERATION_FAILED`). This runs during app install/setup seeding, so the error indicates the workflow could not be created in this workspace.","triggerScenarios":"The `createWorkflow` mutation returns no id because the workflow name violates a constraint (duplicate name, invalid characters, length), the acting user cannot create workflows, or the server returned an error shape that leaves `id` unset. The `seed.workflowName` is interpolated so the offending name is visible.","commonSituations":"Re-running the seeder against a workspace where the workflow already exists with the same name and the server rejects duplicates by returning no id; a permissions change on the installing user; a workflow-schema change requiring fields the seed does not set.","solutions":["Check whether a workflow named `seed.workflowName` already exists in the workspace; if so, reuse it instead of creating (or make the seed idempotent).","Log the full `createResult` including any `errors` to see the server's reason for omitting the id.","Confirm the acting user/role has permission to create workflows.","Validate `seed.workflowName` against the workflow name constraints (uniqueness, length, character set)."],"exampleFix":"// before\nconst workflowId = createResult.createWorkflow?.id;\nif (!isDefined(workflowId)) {\n  throw new PdlOperationError(`Failed to create workflow \"${seed.workflowName}\": no id returned.`);\n}\n\n// after — make the seed idempotent and surface server errors\nlet workflowId = createResult.createWorkflow?.id;\nif (!isDefined(workflowId)) {\n  const existing = await findWorkflowByName(client, seed.workflowName);\n  workflowId = existing?.id;\n}\nif (!isDefined(workflowId)) {\n  throw new PdlOperationError(\n    `Failed to create workflow \"${seed.workflowName}\": no id returned (errors=${JSON.stringify((createResult as any).errors ?? [])})`,\n  );\n}","handlingStrategy":"validation","validationCode":"// Make the seed idempotent: look up an existing workflow by name first.\nconst existing = await findWorkflowByName(client, seed.workflowName);\nif (existing?.id) return existing.id;","typeGuard":"const hasCreatedWorkflowId = (\n  r: unknown,\n): r is { createWorkflow: { id: string } } =>\n  typeof r === 'object' &&\n  r !== null &&\n  typeof (r as any).createWorkflow?.id === 'string';","tryCatchPattern":null,"preventionTips":["Make workflow seeding idempotent (lookup-or-create) so re-runs do not collide on name.","Inspect the client `errors` array when the id is absent.","Validate the workflow name against workspace constraints before creating.","Confirm the acting user has workflow-create permission."],"tags":["pdl","people-data-labs","graphql","mutation","enrichment","workflow","seed"],"backgroundTag":null,"analyzedSha":"1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6","analyzedAt":"2026-08-12T15:37:27.593Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}