twentyhq/twenty · error · Error

Failed to sync CallRecording navigation command menu item av

Error message

Failed to sync CallRecording navigation command menu item availability expression for workspace ${workspaceId}

What it means

Thrown by the 2.17 command that syncs the CallRecording navigation command menu item availability expression when validateBuildAndRunLegacyWorkspaceMigration returns status 'fail'. The logger.error above prints the full result; the thrown error is workspace-scoped. The payload updates commandMenuItem rows in the twentyStandard application.

Source

Thrown at packages/twenty-server/src/database/commands/upgrade-version-command/2-17/2-17-workspace-command-1801000000000-sync-call-recording-navigation-command-menu-item-availability-expression.command.ts:91

    const validateAndBuildResult =
      await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunLegacyWorkspaceMigration(
        {
          isSystemBuild: true,
          workspaceId,
          applicationUniversalIdentifier:
            twentyStandardFlatApplication.universalIdentifier,
          allFlatEntityOperationByMetadataName: {
            commandMenuItem: commandMenuItemOperations,
          },
        },
      );

    if (validateAndBuildResult.status === 'fail') {
      this.logger.error(
        `Failed to sync CallRecording navigation command menu item availability expression:\n${JSON.stringify(validateAndBuildResult, null, 2)}`,
      );

      throw new Error(
        `Failed to sync CallRecording navigation command menu item availability expression for workspace ${workspaceId}`,
      );
    }

    this.logger.log(
      `Successfully synced ${commandMenuItemsToUpdate.length} CallRecording navigation command menu item availability expression(s) for workspace ${workspaceId}`,
    );
  }
}

View on GitHub (pinned to 1f5dd2bbd2)

Solutions

  1. Inspect the logger.error output above the throw to find which commandMenuItem and which validation code failed.
  2. Confirm the targeted CallRecording commandMenuItem rows exist and are unique in the workspace's metadata.
  3. Repair or remove duplicates/half-edited rows, then re-run the upgrade.
  4. Rebuild the image if the standard seed for these commandMenuItem rows is missing.
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the targeted CallRecording commandMenuItem rows exist and are unique.
const rows = await dataSource.query(`
  SELECT "universalIdentifier", count(*) FROM core."commandMenuItem"
  WHERE "universalIdentifier" = ANY($1::text[])
  GROUP BY "universalIdentifier"
`, [targetIdentifiers]);
const dupes = rows.filter((r: any) => r.count > 1);
if (dupes.length) throw new Error(`Duplicate commandMenuItem rows: ${JSON.stringify(dupes)}`);

Type guard

function isFailResult(r: unknown): r is { status: 'fail' } {
  return typeof r === 'object' && r !== null && (r as any).status === 'fail';
}

Try / catch

try {
  const res = await service.validateBuildAndRunLegacyWorkspaceMigration(payload);
  if (res.status === 'fail') throw new Error(`... for workspace ${workspaceId}`);
} catch (err) { upgradeAudit.record(workspaceId, command.id, err); throw err; }

Prevention

When it happens

Trigger: Running the 2.17 upgrade where the commandMenuItem universal identifiers targeted by this command are missing, duplicated, or referenced by an availability expression payload that fails validation (e.g. malformed expression, unknown context, dangling reference).

Common situations: Standard commandMenuItem seed drift between image and workspace; a prior partial migration that left duplicate or half-updated commandMenuItem rows; custom command menu edits conflicting with the availability expression schema.

Related errors


AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12). Data as JSON: /api/errors/feff70f4a0b275c0. Report an issue: GitHub.