Elixir can only use the map update syntax to update a key that is in the map.
defmodule Example do @spec error() :: map def error() do map = %{exists: :exists} %{map | does_not_exist: :fail} end end