Assay.FileDescriptorLimitError exception (assay v0.7.0)

Copy Markdown View Source

Raised when Dialyzer fails to read a .beam file because the operating system refused to open it.

Dialyzer hashes every .beam file in the analysed application tree to decide what the incremental PLT must rebuild. When the process runs out of file descriptors, :beam_lib returns a generic {:error, :beam_lib, {:file_error, _, :emfile}}, which Dialyzer reports as an opaque MD5 failure:

Could not compute MD5 for .beam: _build/dev/lib/foo/ebin/Elixir.Foo.beam

Nothing in that message points at the real cause. On macOS, where the default soft limit is 256 descriptors, it is almost always descriptor exhaustion rather than a corrupt build artifact, so this exception restates the failure with the ulimit invocation that fixes it.

Detection is deliberately narrow. Only the unqualified MD5 message is translated; the (debug_info missing) and (debug_info error) variants describe genuine compilation problems and are left alone.

Summary

Functions

Builds an exception from a raw {:dialyzer_error, message} payload.

Types

t()

@type t() :: %Assay.FileDescriptorLimitError{
  __exception__: term(),
  beam_file: String.t(),
  original_message: String.t(),
  soft_limit: pos_integer() | nil
}

Functions

from_dialyzer_error(message)

@spec from_dialyzer_error(String.t()) :: {:ok, t()} | :error

Builds an exception from a raw {:dialyzer_error, message} payload.

Returns {:ok, error} when the message is the unqualified MD5 failure and the host is macOS, and :error otherwise, so callers can fall back to reporting the original Dialyzer message unchanged.

The current soft descriptor limit is read at this point, while it still reflects the environment the failing run used.