Error: Shortcut "focus_query_bar" from plugin "data" is already registered

Versions: Opensearch 3.3.2 / OpensearchDashboard 3.3.0 Installed on openshift environment via Helm Chart (no operator helm chart)

Describe the issue: I enabled workspaces on the dashboard to separate different workgroups and ensure more restricted access to data.
When any user tries to create a new visualization and selects “Filters” as the aggregation method, they receive the following error:

Error: Shortcut "focus_query_bar" from plugin "data" is already registered
register@https://dashboard-opensearch.apps.wcinfracl.widicoll/8655/bundles/core/core.entry.js:15:562774
register@https://dashboard-opensearch.apps.wcinfracl.widicoll/8655/bundles/core/core.entry.js:15:562283
componentDidMount@https://dashboard-opensearch.apps.wcinfracl.widicoll/8655/bundles/plugin/data/data.chunk.0.js:1:19240
sa@https://dashboard-opensearch.apps.wcinfracl.widicoll/8655/bundles/osd-ui-shared-deps/osd-ui-shared-deps.js:438:83372
pc@https://dashboard-opensearch.apps.wcinfracl.widicoll/8655/bundles/osd-ui-shared-deps/osd-ui-shared-deps.js:438:101246
__osdSharedDeps__</t.unstable_runWithPriority@https://dashboard-opensearch.apps.wcinfracl.widicoll/8655/bundles/osd-ui-shared-deps/osd-ui-shared-deps.js:446:3844
Hi@https://dashboard-opensearch.apps.wcinfracl.widicoll/8655/bundles/osd-ui-shared-deps/osd-ui-shared-deps.js:438:45024
dc@https://dashboard-opensearch.apps.wcinfracl.widicoll/8655/bundles/osd-ui-shared-deps/osd-ui-shared-deps.js:438:97720
Ja@https://dashboard-opensearch.apps.wcinfracl.widicoll/8655/bundles/osd-ui-shared-deps/osd-ui-shared-deps.js:438:93872
Vi/<@https://dashboard-opensearch.apps.wcinfracl.widicoll/8655/bundles/osd-ui-shared-deps/osd-ui-shared-deps.js:438:45315
__osdSharedDeps__</t.unstable_runWithPriority@https://dashboard-opensearch.apps.wcinfracl.widicoll/8655/bundles/osd-ui-shared-deps/osd-ui-shared-deps.js:446:3844
Hi@https://dashboard-opensearch.apps.wcinfracl.widicoll/8655/bundles/osd-ui-shared-deps/osd-ui-shared-deps.js:438:45024
Vi@https://dashboard-opensearch.apps.wcinfracl.widicoll/8655/bundles/osd-ui-shared-deps/osd-ui-shared-deps.js:438:45262
Yi@https://dashboard-opensearch.apps.wcinfracl.widicoll/8655/bundles/osd-ui-shared-deps/osd-ui-shared-deps.js:438:45195
w@https://dashboard-opensearch.apps.wcinfracl.widicoll/8655/bundles/osd-ui-shared-deps/osd-ui-shared-deps.js:438:114344
Qt@https://dashboard-opensearch.apps.wcinfracl.widicoll/8655/bundles/osd-ui-shared-deps/osd-ui-shared-deps.js:438:22726

I found the bug in this GitHub issue ( [BUG] Duplicate Shortcut "focus_query_bar" from plugin "data" and "explore" · Issue #11070 · opensearch-project/OpenSearch-Dashboards · GitHub ), but the pull request that should fix it hasn’t been merged yet.

Is there a workaround I can use to avoid this error?

I’ve already tried setting explore.enabled: false, but I’m still getting the error

The strange thing is that when I try doing the same thing on playground.opensearch.org, I don’t get the error. Am I missing something?

Configuration:

opensearch_dashboards.yml: |
  opensearch.hosts: [ "${OPENSEARCH_HOSTS}" ]
  opensearch.username: ${OPENSEARCH_USERNAME}
  opensearch.password: ${OPENSEARCH_PASSWORD}
  opensearch.ssl.certificateAuthorities: [ "/usr/share/opensearch-dashboards/config/cacerts/service-ca.crt" ]
  logging.verbose: false
  logging.dest: stdout
  opensearch.requestHeadersAllowlist: [ authorization,securitytenant ]
  uiSettings:
    overrides:
      "home:useNewHomePage": true
  workspace.enabled: true
  explore.enabled: true
  data_source.enabled: true
  opensearchDashboards.dashboardAdmin.groups: ["ADMINS", "all_access"]
  savedObjects.permission.enabled: true
  opensearch_security.multitenancy.enabled: false
opensearch.yml: |-
  cluster.name: opensearch-cluster
  network.host: 0.0.0.0
  plugins.security.ssl.http.enabled: true
  plugins.security.ssl.http.pemcert_filepath: certs/http/tls.crt
  plugins.security.ssl.http.pemkey_filepath: certs/http/tls.key
  plugins.security.ssl.http.pemtrustedcas_filepath: cacerts/ca.crt
  #plugins.security.allow_unsafe_democertificates: true
  plugins.security.ssl.transport.enabled: true
  plugins.security.ssl.transport.pemcert_filepath: certs/transport/tls.crt
  plugins.security.ssl.transport.pemkey_filepath: certs/transport/tls.key
  plugins.security.ssl.transport.pemtrustedcas_filepath: cacerts/ca.crt
  plugins.security.ssl.transport.enforce_hostname_verification: false
  plugins.security.authcz.admin_dn:
    - 'CN=opensearch-admin,OU=IT,O=ORG'
  plugins.security.nodes_dn:
    - 'CN=*.opensearch.svc.cluster.local,OU=IT,O=ORG'
  plugins.security.restapi.roles_enabled: ["all_access",
"security_rest_api_access"]

@mbona While this issue is being worked on, have you tried disabling the keyboardShortcuts using the following in the opensearch_dashboards.yml:

opensearchDashboards.keyboardShortcuts.enabled: false

@Anthony Hi, it looks like the error no longer occurs with the configuration you provided. Thank you so much!
I’m fairly new to OpenSearch and I can’t find any information in the documentation about this parameter. Would you be so kind as to explain why disabling it solves my problem?

@mbona Of course, see further details below.

1. Config is read at startup in keyboard_shortcut_service.ts:34-35:

public start(config?: KeyboardShortcutConfig): KeyboardShortcutStart {
  this.config = { enabled: config?.enabled ?? true };

The false value gets stored on the service instance.

2. Every register() call checks it first at keyboard_shortcut_service.ts:59-62:

public register(shortcut: ShortcutDefinition): void {
  if (!this.config.enabled) {
    return;   // <-- exits here, nothing gets stored, no throw
  }
  ...
  if (this.namespacedIdToKeyLookup.has(namespacedId)) {
    throw new Error(`Shortcut "..." from plugin "..." is already registered`);
  }

Therefore with enabled: false, the method returns immediately before reaching the duplicate-check throw. Every call from every QueryStringInput instance just silently no-ops.

3. The event listener is also never started (keyboard_shortcut_service.ts:37-39):

if (this.config.enabled) {
  this.startEventListener();  // <-- skipped, so keypress events never fire shortcuts
}

In short: setting opensearchDashboards.keyboardShortcuts.enabled: false turns the entire keyboard shortcut service into a no-op at startup. Nothing gets registered, nothing throws, and no keyboard shortcuts fire. The Visualize page works because the crash was happening during registration, the actual visualization rendering should not be impacted. The trade-off, however, is all keyboard shortcuts (/ to focus query bar, etc.) are disabled for users.

Thanks again @Anthony