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.13 workspace upgrade command when validateBuildAndRunLegacyWorkspaceMigration returns 'fail' while syncing the availability expression of the create-record command menu items (run with isSystemBuild:true against the twenty-standard application). The full validateAndBuildResult JSON is logged before the throw.
Source
Thrown at packages/twenty-server/src/database/commands/upgrade-version-command/2-13/2-13-workspace-command-1781277470000-sync-create-record-command-availability-expression.command.ts:127
flatEntityToDelete: [],
flatEntityToUpdate: itemsToUpdate,
},
},
workspaceId,
// Standard command menu items are system-owned; without a system
// build the validator rejects direct updates.
isSystemBuild: true,
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 validateAndBuildResult JSON for the exact expression or lookup error.
- Recompute the workspace cache and re-run.
- Run --dryRun to confirm itemsToUpdate targets the create-record items.
- Verify the expression's referenced entities exist in the failing workspace.
Defensive patterns
Strategy: validation
Validate before calling
// Dry-run to preview availability-expression changes, and confirm create-record items exist in cache:
await workspaceCacheService.invalidate(workspaceId);
const { flatCommandMenuItemMaps } = await workspaceCacheService.getOrRecompute(workspaceId, ['flatCommandMenuItemMaps']);
const createItems = Object.values(flatCommandMenuItemMaps.byUniversalIdentifier).filter((i) => isDefined(i) && isCreateRecordCommand(i));
if (createItems.length === 0) throw new Error('No create-record command menu items found to sync'); Try / catch
try {
await command.runOnWorkspace({ workspaceId, options });
} catch (err) {
logger.error(`Create-record availability sync failed for workspace ${workspaceId}`, err);
failedWorkspaces.push(workspaceId);
} Prevention
- Run --dryRun to confirm itemsToUpdate targets create-record items.
- Verify any field/object referenced by the new expression exists in the workspace.
- Recompute the cache before running.
- Catch per-workspace at the runner.
When it happens
Trigger: Running the 2.13 create-record availability-expression sync on a workspace whose create-record command menu items are missing from cache, or whose new availability expression the builder's expression validator rejects.
Common situations: Stale cache so create-record items resolve to undefined; expression references a field/object not present in the workspace; partial prior run left items inconsistent; standard application version mismatch.
Related errors
- Failed to fix merge command menu item expression for workspa
- Failed to update command menu item availability types for wo
- Failed to gate export/import command menu items by permissio
- Failed to update search command menu item labels for workspa
- Failed to add Send Email record-selection commands for works
AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12).
Data as JSON: /api/errors/2e099c23d02061c4.
Report an issue: GitHub.