{"record":{"id":"2e7f38f1f7843b08","repo":"twentyhq/twenty","slug":"failed-to-fix-go-to-roles-settings-command-menu","errorCode":null,"errorMessage":"Failed to fix \"Go to Roles Settings\" command menu item path for workspace ${workspaceId}","messagePattern":"Failed to fix \"Go to Roles Settings\" command menu item path for workspace (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/twenty-server/src/database/commands/upgrade-version-command/2-23/2-23-workspace-command-1784566000000-fix-go-to-roles-settings-command-menu-item-path.command.ts","lineNumber":87,"sourceCode":"    const validateAndBuildResult =\n      await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunWorkspaceMigration(\n        {\n          isSystemBuild: true,\n          workspaceId,\n          applicationUniversalIdentifier:\n            twentyStandardFlatApplication.universalIdentifier,\n          allFlatEntityOperationByMetadataName: {\n            commandMenuItem: commandMenuItemOperations,\n          },\n        },\n      );\n\n    if (validateAndBuildResult.status === 'fail') {\n      this.logger.error(\n        `Failed to fix \"Go to Roles Settings\" command menu item path:\\n${JSON.stringify(validateAndBuildResult, null, 2)}`,\n      );\n\n      throw new Error(\n        `Failed to fix \"Go to Roles Settings\" command menu item path for workspace ${workspaceId}`,\n      );\n    }\n\n    this.logger.log(\n      `Successfully fixed \"Go to Roles Settings\" command menu item path for workspace ${workspaceId}`,\n    );\n  }\n}\n","sourceCodeStart":69,"sourceCodeEnd":97,"githubUrl":"https://github.com/twentyhq/twenty/blob/1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6/packages/twenty-server/src/database/commands/upgrade-version-command/2-23/2-23-workspace-command-1784566000000-fix-go-to-roles-settings-command-menu-item-path.command.ts#L69-L97","documentation":"Thrown by the 2.23 command that fixes the 'Go to Roles Settings' command menu item path to /settings/members#roles. The command computes the update operations via buildFixGoToRolesSettingsCommandMenuItemPathSyncOperations, then calls validateBuildAndRunWorkspaceMigration with commandMenuItem update operations. If the pipeline fails, the detailed report is logged to logger.error and the generic error is thrown.","triggerScenarios":"validateBuildAndRunWorkspaceMigration returns status 'fail' when updating commandMenuItem flat entities. Caused by: the 'Go to Roles Settings' command menu item not existing in the workspace (the sync-operations builder produced updates for a non-existent row), stale flatCommandMenuItemMaps cache, or a validation rejection of the new path value.","commonSituations":"Workspace was provisioned on a version that didn't include the 'Go to Roles Settings' menu item; the command menu item was deleted by a user; cache is stale and reports the item as present when it's not.","solutions":["Read the logger.error JSON output for the specific failure report","Flush flatCommandMenuItemMaps from workspace cache and retry — the command is idempotent (skips if no updates needed)","Verify the 'Go to Roles Settings' command menu item exists in the workspace metadata","Run with --dryRun to inspect the planned updates"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Before running, flush command menu item cache\nawait workspaceCacheService.invalidateAndRecompute(workspaceId, [\n  'flatCommandMenuItemMaps',\n]);\n\n// Confirm the Go to Roles Settings item exists\nconst { flatCommandMenuItemMaps } = await workspaceCacheService.getOrRecompute(workspaceId, [\n  'flatCommandMenuItemMaps',\n]);\n\nconst hasItem = Object.values(flatCommandMenuItemMaps.byUniversalIdentifier)\n  .filter(isDefined)\n  .some((item) => item.path?.includes('roles'));\n\nif (!hasItem) {\n  console.log('Go to Roles Settings item not found — command will skip');\n}","typeGuard":null,"tryCatchPattern":"// Retry once after flushing cache — the command is idempotent\ntry {\n  await command.runOnWorkspace({ workspaceId, options: { dryRun: false } });\n} catch (error) {\n  if (error.message.includes('Failed to fix \"Go to Roles Settings\"')) {\n    await workspaceCacheService.flush(workspaceId, ['flatCommandMenuItemMaps']);\n    await command.runOnWorkspace({ workspaceId, options: { dryRun: false } });\n  } else {\n    throw error;\n  }\n}","preventionTips":["Run with --dryRun first — the command skips if no updates are needed","Flush flatCommandMenuItemMaps cache before retrying","Parse the logger.error JSON for the specific commandMenuItem validation failure","Ensure no concurrent workspace modifications"],"tags":["metadata","upgrade-command","workspace-migration","validate-build-run","command-menu-item"],"backgroundTag":null,"analyzedSha":"1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6","analyzedAt":"2026-08-12T15:37:27.593Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}