EAJ
EAJ
AEAsh Elixir
Created by EAJ on 5/14/2025 in #support
Book seed issue: Tunez.Music.Artist.read had no matching bulk strategy that could be used
When I try to run the first seed script for artists from the book code I get the following error message:
** (Ash.Error.Invalid)
Invalid Error

* Tunez.Music.Artist.read had no matching bulk strategy that could be used.

Requested strategies: [:stream]

Could not use `:stream`: could not stream the query
Could not use `:atomic_batches`: Not in requested strategies
Could not use `:atomic`: Not in requested strategies



Non stream reason:

Action Tunez.Music.Artist.read does not support streaming with one of [:keyset].

There are two ways to handle this.

1.) Use the `allow_stream_with` or `stream_with` options to control what strategies are allowed.
2.) Enable the respective required pagination type on the action read, for example:

# allow keyset
pagination keyset?: true, required?: false

# allow offset
pagination offset?: true, required?: false

# allow both
pagination offset?: true, keyset?: true, required?: false
** (Ash.Error.Invalid)
Invalid Error

* Tunez.Music.Artist.read had no matching bulk strategy that could be used.

Requested strategies: [:stream]

Could not use `:stream`: could not stream the query
Could not use `:atomic_batches`: Not in requested strategies
Could not use `:atomic`: Not in requested strategies



Non stream reason:

Action Tunez.Music.Artist.read does not support streaming with one of [:keyset].

There are two ways to handle this.

1.) Use the `allow_stream_with` or `stream_with` options to control what strategies are allowed.
2.) Enable the respective required pagination type on the action read, for example:

# allow keyset
pagination keyset?: true, required?: false

# allow offset
pagination offset?: true, required?: false

# allow both
pagination offset?: true, keyset?: true, required?: false
This is my Artist resource. I've tried to follow the book, but might have messed something up.
defmodule Tunez.Music.Artist do
use Ash.Resource, otp_app: :tunez, domain: Tunez.Music, data_layer: AshPostgres.DataLayer

postgres do
table "artists"
repo Tunez.Repo
end

actions do
create :create do
accept [:name, :biography]
end

read :read do
primary? true
end

update :update do
accept [:name, :biography]
end

destroy :destroy do
end
end

attributes do
uuid_primary_key :id

attribute :name, :string do
allow_nil? false
end

attribute :biography, :string

create_timestamp :inserted_at
update_timestamp :updated_at
end

relationships do
has_many :albums, Tunez.Music.Album
end
end
defmodule Tunez.Music.Artist do
use Ash.Resource, otp_app: :tunez, domain: Tunez.Music, data_layer: AshPostgres.DataLayer

postgres do
table "artists"
repo Tunez.Repo
end

actions do
create :create do
accept [:name, :biography]
end

read :read do
primary? true
end

update :update do
accept [:name, :biography]
end

destroy :destroy do
end
end

attributes do
uuid_primary_key :id

attribute :name, :string do
allow_nil? false
end

attribute :biography, :string

create_timestamp :inserted_at
update_timestamp :updated_at
end

relationships do
has_many :albums, Tunez.Music.Album
end
end
I am using the unmodified seed script from the code repo: https://github.com/sevenseacat/tunez/blob/main/priv/repo/seeds/01-artists.exs If I remove strategy: :stream from Ash.bulk_destroy! it works.
7 replies