twentyhq/twenty · error · Error
Failed to sync command menu item availability expressions fo
Error message
Failed to sync command menu item availability expressions for workspace ${workspaceId} What it means
Thrown by the 2.7 command that syncs command menu item availability expressions. It updates a batch of command menu items via validateBuildAndRunLegacyWorkspaceMigration; on status === 'fail' it logs the report and throws. The report identifies which command menu item(s) failed the availability-expression validation.
Source
Thrown at packages/twenty-server/src/database/commands/upgrade-version-command/2-7/2-7-workspace-command-1798000020000-sync-command-menu-item-availability-expressions.command.ts:124
allFlatEntityOperationByMetadataName: {
commandMenuItem: {
flatEntityToCreate: [],
flatEntityToDelete: [],
flatEntityToUpdate: itemsToUpdate,
},
},
workspaceId,
applicationUniversalIdentifier:
twentyStandardFlatApplication.universalIdentifier,
},
);
if (validateAndBuildResult.status === 'fail') {
this.logger.error(
`Failed to sync command menu item availability expressions:\n${JSON.stringify(validateAndBuildResult, null, 2)}`,
);
throw new Error(
`Failed to sync command menu item availability expressions for workspace ${workspaceId}`,
);
}
this.logger.log(
`Successfully synced ${itemsToUpdate.length} command menu item availability expression(s) for workspace ${workspaceId}`,
);
}
}
View on GitHub (pinned to 1f5dd2bbd2)
Solutions
- Read the logged JSON report to find the failing item and whether it is a missing-entity or expression-syntax error.
- For a missing entity, seed or rename-restore it; for an invalid expression, correct or clear the stored expression for that item.
- Re-run the 2.7 command for the workspace.
Defensive patterns
Strategy: validation
Validate before calling
// Validate each availability expression's referenced identifiers exist before syncing:
for (const item of itemsToUpdate) {
const refs = extractExpressionRefs(item.availabilityExpression);
const missing = refs.filter(r => !isDefined(flatObjectMetadataMaps.byUniversalIdentifier[r]));
if (missing.length > 0) { /* repair expression first */ }
} Try / catch
try {
await command.runOnWorkspace({ workspaceId, options });
} catch (e) {
logger.error({ workspaceId, err: e.message }, 'command menu availability sync failed');
} Prevention
- Run prerequisite upgrades that rename/seed referenced objects before syncing expressions.
- On failure, read the logged report to find the invalid expression.
When it happens
Trigger: An availability expression references a field/object/relation that was renamed or removed; a command menu item universalIdentifier in the update batch no longer exists in the workspace; the expression string fails the expression-validator (syntax error, unknown function).
Common situations: Cross-version upgrade where referenced fields were renamed in an intermediate release; workspace with custom command menu items whose identifiers drifted; malformed expression left by a prior partial run.
Related errors
- Failed to sync "Discard Draft" workflow command menu item av
- 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/80f6d90fcc2e83da.
Report an issue: GitHub.