twentyhq/twenty · error · Error
Failed to create draft version
Error message
Failed to create draft version
What it means
Thrown in useGetUpdatableWorkflowVersionOrThrow when the workflow's current version is not already a DRAFT, so it tries to create a draft copy via createDraftFromWorkflowVersion, but the returned draftVersionId is undefined. Editing a published workflow requires a draft; without one the edit flow cannot proceed.
Source
Thrown at packages/twenty-front/src/modules/workflow/hooks/useGetUpdatableWorkflowVersionOrThrow.ts:31
);
const workflow = useWorkflowWithCurrentVersion(workflowVisualizerWorkflowId);
const getUpdatableWorkflowVersion = async (): Promise<string> => {
if (!isDefined(workflowVisualizerWorkflowId) || !isDefined(workflow)) {
throw new Error('Failed to get updatable workflow version');
}
if (workflow.currentVersion.status === 'DRAFT') {
return workflow.currentVersion.id;
}
const draftVersionId = await createDraftFromWorkflowVersion({
workflowId: workflowVisualizerWorkflowId,
workflowVersionIdToCopy: workflow.currentVersion.id,
});
if (!isDefined(draftVersionId)) {
throw new Error('Failed to create draft version');
}
return draftVersionId;
};
return { getUpdatableWorkflowVersion };
};
View on GitHub (pinned to 1f5dd2bbd2)
Solutions
- Inspect the createDraftFromWorkflowVersion response (data + errors) in DevTools.
- Confirm the user has edit permission on the workflow and the workflow is not locked by another editor.
- Reload the workflow to refresh currentVersion.status; if a DRAFT already exists it should be returned directly.
Example fix
// before: if (!isDefined(draftVersionId)) { throw new Error('Failed to create draft version'); }
// after: if (!isDefined(draftVersionId)) {
// const err = draftErrors?.[0]?.message;
// throw new Error(err ?? 'Failed to create draft version');
// } Defensive patterns
Strategy: try-catch
Validate before calling
const canEditWorkflow = (workflow: { currentVersion: { status: string } } | null): boolean =>
isDefined(workflow) && (workflow.currentVersion.status === 'DRAFT' || true); // creation attempted if not draft Type guard
const isDraftVersion = (status: string): boolean => status === 'DRAFT';
Try / catch
try {
await getUpdatableWorkflowVersion();
} catch (e) {
if (/Failed to create draft version/.test((e as Error).message)) {
notifyUser('You may not have edit rights, or the workflow is locked by another editor.');
}
} Prevention
- Refresh the workflow before editing to obtain an up-to-date currentVersion.status.
- Confirm edit permission and that no other session holds the draft.
- Have createDraftFromWorkflowVersion surface its mutation errors so this throw carries a real reason.
When it happens
Trigger: createDraftFromWorkflowVersion mutation fails or returns no id (permission denied, backend error, version already being edited elsewhere). The mutation resolved with errors but no id.
Common situations: User lacks edit permission on the workflow. Another user/session already holds the draft. Backend error during the copy. Network partial response.
Related errors
- No response from server
- Couldn't create step
- Couldn't duplicate step
- OPERATION_FAILED
- No getAuthTokensFromSSOExchangeToken result
AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12).
Data as JSON: /api/errors/c891817a503497fb.
Report an issue: GitHub.