Skip to content

(KeyError) key :bulk_create_index not found when calling generate_many on Ash 3.10 #2452

@sevenseacat

Description

@sevenseacat

Code of Conduct

  • I agree to follow this project's Code of Conduct

AI Policy

  • I agree to follow this project's AI Policy, or I agree that AI was not used while creating this issue.

Versions

elixir 1.18.3-otp-27
erlang 27.3.4.2

Ash 3.10.0

Operating system

macOS Tahoe

Current Behavior

After upgrading from Ash 3.9 to 3.10, I've started seeing the following when calling generate_many() in tests:

   1) test list appointments doctors with org_patient role see their appointments (MyAppWeb.Graphql.AppointmentsTest)
Error:      test/my_app_web/graphql/appointments_test.exs:178
     ** (KeyError) key :bulk_create_index not found in: %{
       selected: [:id, :date, :start_time, :created_at, :updated_at, :location_id,
        :patient_id, :practitioner_id],
       bulk_action_ref: #Reference<0.1303876295.902823938.2547>
     }. Did you mean:

           * :bulk_action_ref

     stacktrace:
       (ash 3.10.0) lib/ash/actions/create/bulk.ex:1018: anonymous fn/1 in Ash.Actions.Create.Bulk.sort/2
       (elixir 1.18.3) lib/enum.ex:3363: anonymous fn/2 in Enum.sort_by/3
       (elixir 1.18.3) lib/enum.ex:1714: Enum."-map/2-lists^map/1-1-"/2
       (elixir 1.18.3) lib/enum.ex:3363: Enum.sort_by/3
       (ash 3.10.0) lib/ash/actions/create/bulk.ex:1018: Ash.Actions.Create.Bulk.sort/2
       (ash 3.10.0) lib/ash/actions/create/bulk.ex:992: Ash.Actions.Create.Bulk.handle_bulk_result/4
       (ash 3.10.0) lib/ash.ex:3172: Ash.bulk_create!/4
       (ash 3.10.0) lib/ash/generator/generator.ex:822: anonymous fn/1 in Ash.Generator.generate_many/2
       (elixir 1.18.3) lib/enum.ex:1276: anonymous fn/3 in Enum.flat_map/2
       (elixir 1.18.3) lib/enum.ex:4515: anonymous fn/3 in Enum.flat_map/2
       (elixir 1.18.3) lib/stream.ex:1761: anonymous fn/3 in Enumerable.Stream.reduce/3
       (elixir 1.18.3) lib/stream.ex:302: Stream.after_chunk_while/2
       (elixir 1.18.3) lib/stream.ex:1790: Enumerable.Stream.do_done/2
       (elixir 1.18.3) lib/enum.ex:4515: Enum.flat_map/2
       test/my_app_web/graphql/appointments_test.exs:61: MyAppWeb.Graphql.AppointmentsTest.__ex_unit_setup_1/1
       test/my_app_web/graphql/appointments_test.exs:1: MyAppWeb.Graphql.AppointmentsTest.__ex_unit__/2

Reproduction

No response

Expected Behavior

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions