diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/components/package_policy_input_var_field.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/components/package_policy_input_var_field.tsx index 827d1fb2722c2..782e35ba71612 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/components/package_policy_input_var_field.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/components/package_policy_input_var_field.tsx @@ -60,7 +60,7 @@ export const PackagePolicyInputVarField: React.FunctionComponent<{ }) => { const [isDirty, setIsDirty] = useState(false); const { multi, required, type, title, name, description, options } = varDef; - const isInvalid = (isDirty || forceShowErrors) && !!varErrors; + const isInvalid = (isDirty || forceShowErrors) && !!varErrors?.length; const errors = isInvalid ? varErrors : null; const fieldLabel = title || name; const fieldTestSelector = fieldLabel.replace(/\s/g, '-').toLowerCase();