BryanJBryce

BryanJBryce

OrderItem defines the following:

  calculations do
    calculate :subtotal,
              :decimal,
              expr(
                type(price, :decimal) * type(quantity, :decimal) + type(modifiers_total, :decimal)
              ),
              public?: true
  end

  aggregates do
    sum :modifiers_total, :modifiers, :total, public?: true, default: 0
  end

Ash.read!(OrderItem, load: [:modifiers_total, :subtotal]) works as expected

query OrderItem($orderItemId: ID!) {
  orderItem(id: $orderItemId) {
   id
  #  subtotal
  #  modifiersTotal
  modifiers {
    id
    total
  }
  }
}

This GraphQL query works when modifiersTotal/subtotal are not included, but gives the following error on the server when they are:

[error] edd194bb-a06b-42ab-acbd-92e08c25876d: Exception raised while resolving query.

** (KeyError) key :arguments not found in: %{tracer: nil, tenant: nil, authorize?: false, actor: nil}

(ash 3.0.0-rc.45) lib/ash/resource/calculation/expression.ex:10: Ash.Resource.Calculation.Expression.expression/2
(ash_sql 0.1.1-rc.17) lib/aggregate.ex:718: anonymous fn/5 in AshSql.Aggregate.maybe_filter_subquery/6
(elixir 1.16.1) lib/enum.ex:4842: Enumerable.List.reduce/3
(elixir 1.16.1) lib/enum.ex:2582: Enum.reduce_while/3
(ash_sql 0.1.1-rc.17) lib/aggregate.ex:312: anonymous fn/10 in AshSql.Aggregate.add_aggregates/6
(ash_sql 0.1.1-rc.17) lib/join.ex:250: AshSql.Join.related_subquery/3
(ash_sql 0.1.1-rc.17) lib/aggregate.ex:159: anonymous fn/7 in AshSql.Aggregate.add_aggregates/6
(elixir 1.16.1) lib/enum.ex:4842: Enumerable.List.reduce/3
(elixir 1.16.1) lib/enum.ex:2582: Enum.reduce_while/3
(ash_sql 0.1.1-rc.17) lib/aggregate.ex:88: AshSql.Aggregate.add_aggregates/6
(ash 3.0.0-rc.45) lib/ash/query/query.ex:2858: Ash.Query.data_layer_query/2
(ash 3.0.0-rc.45) lib/ash/actions/read/read.ex:436: anonymous fn/5 in Ash.Actions.Read.do_read/4
(ash 3.0.0-rc.45) lib/ash/process_helpers.ex:38: anonymous fn/4 in Ash.ProcessHelpers.async/2
(elixir 1.16.1) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
(elixir 1.16.1) lib/task/supervised.ex:36: Task.Supervised.reply/4
(ash 3.0.0-rc.45) lib/ash/process_helpers.ex:32: Ash.ProcessHelpers.async/2
(ash 3.0.0-rc.45) lib/ash/process_helpers.ex:66: Ash.ProcessHelpers.task_with_timeout/5
(ash 3.0.0-rc.45) lib/ash/actions/read/read.ex:571: Ash.Actions.Read.maybe_in_transaction/3
(ash 3.0.0-rc.45) lib/ash/actions/read/read.ex:251: Ash.Actions.Read.do_run/3
(ash 3.0.0-rc.45) lib/ash/actions/read/read.ex:66: anonymous fn/3 in Ash.Actions.Read.run/3

Full code here: GitHub - BryceLabs/ash_issues_examples at arguments-not-found-query · GitHub

Showing Posts 1 to 4

zachdaniel

zachdaniel

Creator of Ash

Can you include specific steps to reproduce, or ideally a test in the reproduction repo? This looks like a bug on our end, will look into it when I have a chance, but may be a day or two.

BryanJBryce

BryanJBryce OP

Yep, I’ll do that in a Github issue

BryanJBryce

BryanJBryce OP

FYI this is fixed

— All posts loaded —

Where Next? Top

Trending in Questions Top

Hellowman
Hello everyone! I am new to coding with Elixir/Erlang. And i am looking for some utilities for fuzzing testing like AFL++. Does anyone ...
New
yarrichar
I’m very new to Elixir, so sorry if this is a silly question: I am wondering what happens to the mailbox of a process when the machine i...
New
pragdave
How do I tell Hologram not to escape HTML when substituting into templates? {Textile.render(@product.long_description)} escapes the HTM...
New
Fl4m3Ph03n1x
Background When trying to execute mix release on a Windows 11 machine for a Phoenix project I get the following error: * assembling mark...
New
mandar1045
I load tested a plain Phoenix chat app backed by Postgres with 100 million messages in it, everything on default settings, to see what br...
New
rlipscombe
I’d like to create a file with 600 permissions (rw-------), but there’s a race condition if I create it and then change the permissions. ...
New
saleyn
Is there a way to import record definitions in the iex shell for pretty printing (similar to the rr command in the erl shell)? This woul...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
261 13183 112
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
charlenopires
Hi everyone :waving_hand: I’ve been working on PhiaUI, an open-source UI component library for Phoenix LiveView, and I wanted to share i...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews