…showing validation error (#211661) (#220427)
# Backport
This will backport the following commits from `main` to `8.19`:
- [[dashboard] fix invalid dashboard displayed as 404 instead of showing
validation error
(#211661)](#211661)
<!--- Backport version: 9.6.6 -->
### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)
<!--BACKPORT [{"author":{"name":"Nathan
Reese","email":"reese.nathan@elastic.co"},"sourceCommit":{"committedDate":"2025-05-07T19:32:04Z","message":"[dashboard]
fix invalid dashboard displayed as 404 instead of showing validation
error (#211661)\n\nCloses
https://github.com/elastic/kibana/issues/211659\n\nPR updates
`loadDashboardState` to throw content management error when\nstatus is
not a 404. PR does not attempt to clean-up DashboardRenderer's\ndisplay
of the error.\n\n<img width=\"500\" alt=\"Screenshot 2025-05-07 at 8 20
02 AM\"\nsrc=\"https://github.com/user-attachments/assets/39883951-d4df-46fa-9950-bb8103898b6b\"\n/>\n\n\n###
test instructions\n1) use saved object import to import dashboard with
schema errors
-\nhttps://github.com/elastic/kibana/blob/main/x-pack/test/functional/apps/dashboard/group2/migration_smoke_tests/exports/lens_dashboard_migration_test_7_12_1.ndjson.\n2)
open dashboard, verify schema validation error is
displayed.\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"670ff4ee06089711a20201c0093c83abbe4db2bf","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Presentation","backport:version","v9.1.0","v8.19.0"],"title":"[dashboard]
fix invalid dashboard displayed as 404 instead of showing validation
error","number":211661,"url":"https://github.com/elastic/kibana/pull/211661","mergeCommit":{"message":"[dashboard]
fix invalid dashboard displayed as 404 instead of showing validation
error (#211661)\n\nCloses
https://github.com/elastic/kibana/issues/211659\n\nPR updates
`loadDashboardState` to throw content management error when\nstatus is
not a 404. PR does not attempt to clean-up DashboardRenderer's\ndisplay
of the error.\n\n<img width=\"500\" alt=\"Screenshot 2025-05-07 at 8 20
02 AM\"\nsrc=\"https://github.com/user-attachments/assets/39883951-d4df-46fa-9950-bb8103898b6b\"\n/>\n\n\n###
test instructions\n1) use saved object import to import dashboard with
schema errors
-\nhttps://github.com/elastic/kibana/blob/main/x-pack/test/functional/apps/dashboard/group2/migration_smoke_tests/exports/lens_dashboard_migration_test_7_12_1.ndjson.\n2)
open dashboard, verify schema validation error is
displayed.\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"670ff4ee06089711a20201c0093c83abbe4db2bf"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/211661","number":211661,"mergeCommit":{"message":"[dashboard]
fix invalid dashboard displayed as 404 instead of showing validation
error (#211661)\n\nCloses
https://github.com/elastic/kibana/issues/211659\n\nPR updates
`loadDashboardState` to throw content management error when\nstatus is
not a 404. PR does not attempt to clean-up DashboardRenderer's\ndisplay
of the error.\n\n<img width=\"500\" alt=\"Screenshot 2025-05-07 at 8 20
02 AM\"\nsrc=\"https://github.com/user-attachments/assets/39883951-d4df-46fa-9950-bb8103898b6b\"\n/>\n\n\n###
test instructions\n1) use saved object import to import dashboard with
schema errors
-\nhttps://github.com/elastic/kibana/blob/main/x-pack/test/functional/apps/dashboard/group2/migration_smoke_tests/exports/lens_dashboard_migration_test_7_12_1.ndjson.\n2)
open dashboard, verify schema validation error is
displayed.\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"670ff4ee06089711a20201c0093c83abbe4db2bf"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
Co-authored-by: Nathan Reese <reese.nathan@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Closes #211659
PR updates
loadDashboardStateto throw content management error when status is not a 404. PR does not attempt to clean-up DashboardRenderer's display of the error.test instructions