     {:error, message} -> {:error, message}
   end
 
-  defp validate_mode!(app, mode, modes, children) do
+  defp validate_mode!(app, mode, modes, children, optional) do
     safe_mode? = mode in @safe_modes
 
     if not safe_mode? and mode not in @unsafe_modes do

      child_mode = Keyword.get(modes, child)

      cond do
        is_nil(child_mode) ->
          throw(
            {:error,
             "Application #{inspect(app)} is listed in the release boot, " <>

      for {app, mode} <- modes do
        properties = Map.get(apps, app) || throw({:error, "Unknown application #{inspect(app)}"})
        children = Keyword.get(properties, :applications, [])
        optional = Keyword.get(properties, :optional_applications, [])
        app in skip_mode_validation_for || validate_mode!(app, mode, modes, children, optional)
        build_app_for_release(app, mode, properties)
      end

