ArgumentError related to Ash.get!/3

create :purchase do
argument :project_id, :integer, allow_nil?: false

manual fn changeset, _ →
project_id = changeset.arguments.project_id

# Ensure the organization relationship including the country field is loaded
project_query = 
  Core.Project
  |> Ash.Query.load(organization: [:country])

# Fetch the project with the organization loaded
project = Ash.get!(project_query, project_id, actor: changeset.context.private.actor)

# Access the loaded organization relationship
organization = project.organization
country = organization.country 1) test purchase action successfully purchases a number (Calleebree.Core.TwilioNumberTest)
 lib/calleebree/core/twilio_number_test.exs:83
 ** (Ash.Error.Unknown) Unknown Error

 * %ArgumentError{message: "Expected an Ash.Resource in Ash.get!/3, got: #Ash.Query<resource: Calleebree.Core.Project, load: [organization: []]>"}
   (ash 3.0.16) lib/ash.ex:1351: Ash.get!/3
   (console 0.1.0) lib/calleebree/core/twilio_number.ex:86: Calleebree.Core.TwilioNumber.manual_0_generated_2E90AC1473AE1FE279541EC6375CE146/2 CAN anyone help please ? is there any problem with the pipe ?

Hello! This question is formatted in a way that is quite difficult to read, however, I can see what your issue is so I will answer.

Ash.get! expects to receive a resource, not a query. There is a load option to Ash.get that you can use for this:

Ash.get!(Core.Project, project_id, actor: changeset.context.private.actor, load: [organization: [:country]])