twentyhq/twenty · error · Error
Failed to sync "Discard Draft" workflow command menu item av
Error message
Failed to sync "Discard Draft" workflow command menu item availability expression for workspace ${workspaceId} What it means
Thrown by the 2.28 command that syncs the 'Discard Draft' workflow command menu item's availability expression. It updates the command menu item via validateBuildAndRunLegacyWorkspaceMigration; on status === 'fail' it logs the report and throws. Failure is in the command-menu-item update validation.
Source
Thrown at packages/twenty-server/src/database/commands/upgrade-version-command/2-28/2-28-workspace-command-1785858486000-sync-discard-draft-workflow-availability-expression.command.ts:86
allFlatEntityOperationByMetadataName: {
commandMenuItem: {
flatEntityToCreate: [],
flatEntityToDelete: [],
flatEntityToUpdate: commandMenuItemsToUpdate,
},
},
workspaceId,
applicationUniversalIdentifier:
twentyStandardFlatApplication.universalIdentifier,
},
);
if (validateAndBuildResult.status === 'fail') {
this.logger.error(
`Failed to sync "Discard Draft" workflow command menu item availability expression:\n${JSON.stringify(validateAndBuildResult, null, 2)}`,
);
throw new Error(
`Failed to sync "Discard Draft" workflow command menu item availability expression for workspace ${workspaceId}`,
);
}
this.logger.log(
`Successfully synced "Discard Draft" workflow command menu item availability expression for workspace ${workspaceId}`,
);
}
}
View on GitHub (pinned to 1f5dd2bbd2)
Solutions
- Read the logged JSON report to see whether the failure is a missing-entity or an expression-validation error.
- If the command menu item is missing, ensure the upgrade command that seeds it (earlier in the version chain) ran for the workspace.
- If the expression is invalid, correct or clear the stored availability expression for that item, then re-run the 2.28 command.
Defensive patterns
Strategy: validation
Validate before calling
// Confirm the target command menu item exists before running the 2.28 sync:
const item = flatCommandMenuItemMaps.byUniversalIdentifier[DISCARD_DRAFT_UI];
if (!isDefined(item)) { /* run the command that seeds it first */ } Try / catch
try {
await command.runOnWorkspace({ workspaceId, options });
} catch (e) {
logger.error({ workspaceId, err: e.message }, 'Discard Draft availability sync failed');
} Prevention
- Run prerequisite upgrade commands that seed command menu items before availability-expression syncs.
- Validate availability expressions against the current object/field identifiers before applying.
When it happens
Trigger: The 'Discard Draft' command menu item universalIdentifier does not exist in the workspace (so the update targets nothing); the availability expression string fails the expression validator (syntax/unknown reference); the twentyStandardFlatApplication linkage is broken for the workspace.
Common situations: Workspace on a version that never had the Discard Draft command menu item seeded; the expression references a field/object that was since renamed; cross-version upgrade where an intermediate command that creates the item was skipped.
Related errors
- Failed to sync command menu item availability expressions fo
- Failed to add the Block Settings command menu item for works
- Failed to add NOT_RECORDED to CallRecording status metadata
- Failed to backfill standard skills for workspace ${workspace
- Failed to create the workspaceMember openRecordIn field for
AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12).
Data as JSON: /api/errors/a5181519fdefb993.
Report an issue: GitHub.