Opensearch-dashboard return http 500 error when using a shortURL to visit

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):

2.18.0

Describe the issue:
my opensearch-dashboard has multi-tenant configured, and has openid authentication enabled.
if use openid login to the webui first, then visit a dashboard, it works fine.
if use the long url to visit the dashboard drectly, it works fine.

however, if visit the dashboard with a short URL and tenant header, it returns http 500 error.
meanwhile, if I enter the short URL again in the http 500 page again, then it works.

my short URL looks like this:
http://my-os-dashboard-base-rul/goto/8b047812ad53d5a79054aeb42599bf75?security_tenant=auditlogging-tenant

when the 1st time enter this URL, it redirect to my idp for openid auth, then redirect back to the short url without the ?security_tenant=auditlogging-tenant in header.

when it displays http 500 error, if I enter the URL again without the ?security_tenant=auditlogging-tenant , it still returns 500;
if I enter the url again with ?security_tenant=auditlogging-tenant , it work again.

from the pod log, I see:
{“type”:“log”,“@timestamp”:“2025-01-15T08:24:39Z”,“tags”:[“error”,“http”,“server”,“OpenSearchDashboards”],“pid”:1,“message”:“TypeError: Cannot read properties of undefined (reading ‘location’)\n at addTenantParameterToResolvedShortLink (/usr/share/opensearch-dashboards/plugins/securityDashboards/server/multitenancy/tenant_resolver.ts:213:46)\n at /usr/share/opensearch-dashboards/plugins/securityDashboards/server/plugin.ts:140:46\n at interceptPreResponse (/usr/share/opensearch-dashboards/src/core/server/http/lifecycle/on_pre_response.js:107:30)\n at exports.Manager.execute (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/toolkit.js:57:29)\n at Request._invoke (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/request.js:398:55)\n at processTicksAndRejections (node:internal/process/task_queues:95:5)\n at Request._postCycle (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/request.js:469:32)\n at Request._reply (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/request.js:448:9)”}
{“type”:“error”,“@timestamp”:“2025-01-15T08:24:39Z”,“tags”:,“pid”:1,“level”:“error”,“error”:{“message”:“Internal Server Error”,“name”:“Error”,“stack”:“Error: Internal Server Error\n at HapiResponseAdapter.toInternalError (/usr/share/opensearch-dashboards/src/core/server/http/router/response_adapter.js:69:19)\n at interceptPreResponse (/usr/share/opensearch-dashboards/src/core/server/http/lifecycle/on_pre_response.js:139:34)\n at exports.Manager.execute (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/toolkit.js:57:29)\n at Request._invoke (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/request.js:398:55)\n at processTicksAndRejections (node:internal/process/task_queues:95:5)\n at Request._postCycle (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/request.js:469:32)\n at Request._reply (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/request.js:448:9)”},“url”:“https://my-os-dashboard-base-rul/goto/8b047812ad53d5a79054aeb42599bf75",“message”:"Internal Server Error”}

Configuration:

Relevant Logs or Screenshots:

@latituder Could you share your opensearch_dashboards.yml file?
What is your OpenID IDP?