Internal Server Error : SavedObjectReferenceResolutionError: Failed to resolve Inventory default view "inventory-saved-view-0" (after 7.14.0 -> 7.16.1 migration)

Before migrating from ELK 7.14.0 to ELK 7.16.1I had configured a specific Default Inventory view in the Observability Metrics App.

After migration I get the following error

[2021-12-16T18:31:48.765+01:00][ERROR][http] SavedObjectReferenceResolutionError: Failed to resolve Inventory default view "inventory-saved-view-0".
    at resolveInventoryViewSavedObjectReferences (/usr/share/kibana/x-pack/plugins/infra/server/lib/sources/saved_object_references.js:154:13)
    at /usr/share/kibana/x-pack/plugins/infra/server/lib/sources/saved_object_references.js:49:238
    at Array.reduce (<anonymous>)
    at resolveSavedObjectReferences (/usr/share/kibana/x-pack/plugins/infra/server/lib/sources/saved_object_references.js:49:195)
    at /usr/share/kibana/x-pack/plugins/infra/server/lib/sources/sources.js:190:76
    at /usr/share/kibana/node_modules/fp-ts/lib/Either.js:280:52
    at pipe (/usr/share/kibana/node_modules/fp-ts/lib/function.js:192:23)
    at convertSavedObjectToSavedSourceConfiguration (/usr/share/kibana/x-pack/plugins/infra/server/lib/sources/sources.js:185:88)
    at InfraSources.getSavedSourceConfiguration (/usr/share/kibana/x-pack/plugins/infra/server/lib/sources/sources.js:164:12)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at InfraSources.getSourceConfiguration (/usr/share/kibana/x-pack/plugins/infra/server/lib/sources/sources.js:48:38)
    at async Promise.all (index 0)
    at /usr/share/kibana/x-pack/plugins/infra/server/routes/metrics_sources/index.js:47:55
    at Router.handle (/usr/share/kibana/src/core/server/http/router/router.js:163:30)
    at handler (/usr/share/kibana/src/core/server/http/router/router.js:124:50)

It looks like my inventory-view cannot be found, how can I reset it to the default ?

I've also run a metricbeat setup but it didn't solve the issue.

From a user point of view it looks like this

We have the same issue after upgrading our Elastic Cloud cluster from 7.15.2 to 7.16.1

Error while fetching resource
Error
(500)
URL
https://kibana.domain.com/api/metrics/source/default
Message
An internal server error occurred.

Also on Rules and Connectors we have some rules with status error message: Failed to resolve Inventory default view "inventory-saved-view-0"

Manual migration of the saved objects proposed in this issue solved the error.

Thanks a lot !
This solved the issue at hand, I have another that I need to deal with, but as far as this post goes it's solved :slight_smile:

I'll keep this post updated for any other visitors.

The error is the following :

Error: no codec found to encode value in union type ({ type: "count" | "cpu" | "load" | "memory" | "tx" | "rx" | "logRate" | "diskIOReadBytes" | "diskIOWriteBytes" | "s3TotalRequests" | "s3NumberOfObjects" | "s3BucketSize" | "s3DownloadBytes" | "s3UploadBytes" | "rdsConnections" | "rdsQueriesExecuted" | "rdsActiveTransactions" | "rdsLatency" | "sqsMessagesVisible" | "sqsMessagesDelayed" | "sqsMessagesSent" | "sqsMessagesEmpty" | "sqsOldestMessage" | "custom" } | ({ type: "custom", field: string, aggregation: "avg" | "max" | "min" | "rate", id: string } & Partial<{ label: string }>))
e.union/<@https://xx:5601/46258/bundles/plugin/infra/8.0.0/infra.plugin.js:2:13061
e.type/<@https://xx:5601/46258/bundles/plugin/infra/8.0.0/infra.plugin.js:2:9885
e.intersection/</<@https://xx:5601/46258/bundles/plugin/infra/8.0.0/infra.plugin.js:2:14044
e.intersection/<@https://xx:5601/46258/bundles/plugin/infra/8.0.0/infra.plugin.js:2:14018
O@https://xx:5601/46258/bundles/plugin/infra/8.0.0/infra.chunk.6.js:9:21079
91/o/f<@https://xx:5601/46258/bundles/plugin/infra/8.0.0/infra.chunk.2.js:3:53292
78/k</<@https://xx:5601/46258/bundles/plugin/infra/8.0.0/infra.chunk.6.js:9:21384
Ms@https://xx:5601/46258/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:447:84721
Wu@https://xx:5601/46258/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:447:104435
__kbnSharedDeps_npm__</t.unstable_runWithPriority@https://xx:5601/46258/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:455:3462
Xi@https://xx:5601/46258/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:447:45747
zu@https://xx:5601/46258/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:447:104176
Ou@https://xx:5601/46258/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:447:94230
Ji/<@https://xx:5601/46258/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:447:46038
__kbnSharedDeps_npm__</t.unstable_runWithPriority@https://xx:5601/46258/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:455:3462
Xi@https://xx:5601/46258/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:447:45747
Ji@https://xx:5601/46258/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:447:45985
Qi@https://xx:5601/46258/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:447:45918
yu@https:/xx:5601/46258/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:447:91140
enqueueSetState@https://xx:5601/46258/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:447:50827
__kbnSharedDeps_npm__</_.prototype.setState@https://xx:5601/46258/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:431:1439
114/AutoSizer/</<@https://xx:5601/46258/bundles/plugin/infra/8.0.0/infra.chunk.1.js:3:4717

Edit : This was solved by setting the savedView variable in URL to (viewId:0) then creating a new view and setting it to default.