Ash Embedded + Custom types error: UnknownError{error: "** (ArgumentError)

Whenever I try to use a custom type like ex_money or a custom type I create, ash does not seem to be able to load an embedded resource. Not sure if I’m missing some config with embedded resources or this is a bug.

Here is an example error with a volume type:

%Ash.Error.Unknown{
errors: [
%Ash.Error.Unknown.UnknownError{error: "** (ArgumentError) cannot load `[%{\"autogenerated_id\" => \"0f887d5a-d861-49c5-ac39-9a33ec5b732c\", \"from_volume\" => [\"cu_ft\", 0], \"price\" => [\"USD\", \"1\"], \"to_volume\" => [\"cu_ft\", 10]}]` as type {:array, #EmbeddedResource.EctoType<[]>
} 

Weirdly I have to implement Jason.Encoder for tuples for it to even get to this error. I figured it has something to do with the Ash type, since I’m able to use these custom types in non Ash projects.

%Ash.Error.Unknown{
errors: [%Ash.Error.Unknown.UnknownError{
error: "** (Protocol.UndefinedError) protocol Jason.Encoder not implemented for {\"cu_ft\", 0} of type Tuple, Jason.Encoder protocol must always be explicitly implemented. This protocol is implemented for the following type(s): Any, Ash.CiString, Ash.Union, Atom, BitString, Cldr.LanguageTag, Date, DateTime, Decimal, Ecto.Association.NotLoaded, Ecto.Schema.Metadata, ...

:thinking: Can you open an issue on ash_json_api with a stack trace as well?

I think this an ash core issue?

Submitted! Here is the link to the issue for reference