Skip to content

UI crashes on migrated persona documents with null pages #31980

Description

@harshach

Affected module

UI

Describe the bug

After upgrading from OpenMetadata 1.13.3 to 2.0.0, opening Data Marketplace can crash with TypeError: Cannot read properties of null (reading 'pageType'). Migrated persona DocStore documents can contain a null entry in data.pages, while the Data Marketplace and My Data readers dereference every entry during find.

To Reproduce

  1. Upgrade an installation from 1.13.3 to 2.0.0.
  2. Use a persona whose UI customization document contains a payload such as {"data":{"pages":[{"pageType":"LandingPage"},null]}}.
  3. Open Data Marketplace.
  4. Observe the page crash while resolving the persona layout.

Expected behavior

Invalid legacy page entries should be ignored and the page should render the matching customized layout or its default layout. Resetting a page that has never been customized should also not append an undefined value that is serialized as null.

OS

Not OS-specific.

Python version

Not applicable.

OpenMetadata version

2.0.0, upgraded from 1.13.3.

OpenMetadata Ingestion package version

Not applicable.

Additional context

The DocStore payload is generic JSON, so no database schema migration is required. The UI should normalize legacy payloads at the shared query boundary, retain defensive page lookups in consumers, and prevent writers from persisting new null entries.

Temporary workaround for 2.0.0

Until a release containing the fix is available, an administrator can remove only the null entries from the affected persona document through the API. Back up and inspect the document before applying the patch; replace the three values below and use a JWT belonging to an admin or bot allowed to edit DocStore documents.

set -euo pipefail

OM_URL='https://openmetadata.example.com'
PERSONA_FQN='Data Steward'
OM_TOKEN='replace-with-admin-jwt'

ENCODED_DOC_FQN=$(jq -rn \
  --arg value "persona.${PERSONA_FQN}" '$value | @uri')

# Keep this file until the workaround has been verified.
curl --fail --silent --show-error \
  --header "Authorization: Bearer ${OM_TOKEN}" \
  "${OM_URL%/}/api/v1/docStore/name/${ENCODED_DOC_FQN}" \
  --output persona-document-backup.json

# Review the affected indexes. An empty array means no workaround is needed.
jq '[.data.pages | to_entries[] | select(.value == null) | .key]' \
  persona-document-backup.json

# Remove from the highest index first so multiple null entries are handled safely.
jq -c \
  '[.data.pages | to_entries[] | select(.value == null) |
    {op:"remove", path:("/data/pages/" + (.key | tostring))}] | reverse' \
  persona-document-backup.json > remove-null-pages.patch.json

# This must show one or more remove operations and no other operation type.
jq . remove-null-pages.patch.json
jq -e 'length > 0 and all(.[]; .op == "remove")' \
  remove-null-pages.patch.json >/dev/null

DOC_ID=$(jq -er '.id' persona-document-backup.json)

curl --fail --silent --show-error \
  --request PATCH \
  --header "Authorization: Bearer ${OM_TOKEN}" \
  --header 'Content-Type: application/json-patch+json' \
  --data-binary @remove-null-pages.patch.json \
  "${OM_URL%/}/api/v1/docStore/${DOC_ID}" \
  | jq '.data.pages |
      {pageCount: length, nullCount: (map(select(. == null)) | length)}'

unset OM_TOKEN

The final output should report nullCount: 0. Refresh Data Marketplace after the patch; if anything unexpected occurs, retain persona-document-backup.json and stop before making further changes. For the example payload in this issue, the generated patch is [{"op":"remove","path":"/data/pages/3"}]; generate it from the live response rather than copying that index because other personas can differ.

Pre-submission checklist

  • I searched for duplicate issues.
  • I removed credentials, hostnames, emails, and other sensitive data from logs and config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    In Review / QA 👀

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions