diff --git a/x-pack/plugins/fleet/server/services/managed_package_policies.ts b/x-pack/plugins/fleet/server/services/managed_package_policies.ts index e78bc096b8711..c702cfe96d986 100644 --- a/x-pack/plugins/fleet/server/services/managed_package_policies.ts +++ b/x-pack/plugins/fleet/server/services/managed_package_policies.ts @@ -74,7 +74,7 @@ export const upgradeManagedPackagePolicies = async ( if (dryRunResults.hasErrors) { const errors = dryRunResults.diff ? dryRunResults.diff?.[1].errors - : dryRunResults.body?.message; + : [dryRunResults.body?.message]; appContextService .getLogger() diff --git a/x-pack/plugins/fleet/server/services/setup.ts b/x-pack/plugins/fleet/server/services/setup.ts index 1c84073552e57..d39a5f4473199 100644 --- a/x-pack/plugins/fleet/server/services/setup.ts +++ b/x-pack/plugins/fleet/server/services/setup.ts @@ -220,8 +220,15 @@ export function formatNonFatalErrors( name: e.error.name, message: e.error.message, }; - } else { + } else if ('errors' in e) { return e.errors.map((upgradePackagePolicyError: any) => { + if (typeof upgradePackagePolicyError === 'string') { + return { + name: 'SetupNonFatalError', + message: upgradePackagePolicyError, + }; + } + return { name: upgradePackagePolicyError.key, message: upgradePackagePolicyError.message,