Ash FrameworkAF
Ash Framework2mo ago
11 replies
maccachan0009

Warning(Unhandled error in form submission) when validating a form with embedded resource

I have created two embedded resources (membership_purchase and member_purchase_info). They are embedded resources just for being used in a form so I can have validations more easily. Membership_purchase can have multiple member_purchase_info. (For details, please see attachments.)
attribute :member_purchase_infos, {:array, Marge.AshDomains.Members.MemberPurchaseInfo},
      allow_nil?: false,
      public?: true
  end


Everything works fine. All validations work fine and validation messages are displayed correctly in the UI. But whenever the Marge.AshDomains.Members.Validations.ValidateAge is not passed and returning an error e.g. {:error, field: :dob, message: "Age cannot be less than 18"} , there will be a warning in the log:
[warning] Unhandled error in form submission for Marge.AshDomains.Members.MembershipPurchase.create

This error was unhandled because Ash.Error.Unknown.UnknownError does not implement the `AshPhoenix.FormData.Error` protocol.

** (Ash.Error.Unknown.UnknownError) Bread Crumbs:
> Exception raised in bulk create: Marge.AshDomains.Members.MemberPurchaseInfo.create
  
Age cannot be less than 18


The form and flow are working fine, as I am not really creating anything in the database. I just use it as a form to get data from user and then process it in the next step. So my question is how I can suppress this warning?
Screenshot_2025-11-17_at_2.33.39_PM.png
Screenshot_2025-11-17_at_2.34.13_PM.png
Was this page helpful?