Chrichton

Chrichton

** (Ash.Error.Invalid) Invalid Error * No such field name for resource

I am creating an admin app with data similar to the Tunez app from the Ash book from PragPro.
I want to query the artists by name sorted by name.

Using the tunez code, I am able to query via:

 Tunez.Music.search_artists!("a", query: [sort_input: "name"])

When querying with my app via:

Tuneshg.Music.search_artists!("a", query: [sort_input: "name"])

I get:

** (Ash.Error.Invalid) 
Invalid Error

* No such field name for resource Tuneshg.Music.Artist
    at sort
  (ash 3.4.55) lib/ash/error/query/no_such_field.ex:5: Ash.Error.Query.NoSuchField.exception/1
  (ash 3.4.55) lib/ash/sort/sort.ex:210: Ash.Sort.parse_sort/3
  (ash 3.4.55) lib/ash/sort/sort.ex:131: anonymous fn/4 in Ash.Sort.parse_input/3
  (elixir 1.18.1) lib/enum.ex:4964: Enumerable.List.reduce/3
  (elixir 1.18.1) lib/enum.ex:2600: Enum.reduce_while/3
  (ash 3.4.55) lib/ash/sort/sort.ex:130: Ash.Sort.parse_input/3
  (ash 3.4.55) lib/ash/query/query.ex:323: Ash.Query.sort_input/3
  (elixir 1.18.1) lib/enum.ex:2546: Enum."-reduce/3-lists^foldl/2-0-"/3
  (tuneshg 0.1.0) deps/ash/lib/ash/code_interface.ex:676: Tuneshg.Music.search_artists!/3
  (elixir 1.18.1) src/elixir.erl:386: :elixir.eval_external_handler/3
  (stdlib 6.2) erl_eval.erl:919: :erl_eval.do_apply/7
  (elixir 1.18.1) src/elixir.erl:364: :elixir.eval_forms/4
  (elixir 1.18.1) lib/module/parallel_checker.ex:120: Module.ParallelChecker.verify/1
  (iex 1.18.1) lib/iex/evaluator.ex:336: IEx.Evaluator.eval_and_inspect/3
  (iex 1.18.1) lib/iex/evaluator.ex:310: IEx.Evaluator.eval_and_inspect_parsed/3
  (iex 1.18.1) lib/iex/evaluator.ex:299: IEx.Evaluator.parse_eval_inspect/4
  (iex 1.18.1) lib/iex/evaluator.ex:189: IEx.Evaluator.loop/1
  (iex 1.18.1) lib/iex/evaluator.ex:34: IEx.Evaluator.init/5
  (stdlib 6.2) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
    (ash 3.4.55) lib/ash/error/invalid.ex:3: Ash.Error.Invalid.exception/1
    (ash 3.4.55) /Volumes/Quizzlab/Projects/tuneshg/deps/splode/lib/splode.ex:264: Ash.Error.to_class/2
    (ash 3.4.55) lib/ash/error/error.ex:108: Ash.Error.to_error_class/2
    (ash 3.4.55) lib/ash/actions/read/read.ex:29: Ash.Actions.Read.run/3
    (ash 3.4.55) lib/ash.ex:2008: Ash.read/2
    (ash 3.4.55) lib/ash.ex:1966: Ash.read!/2
    iex:4: (file)

The artist search action, and attributes are the same
The album define :search_artists are the same.

What could be the reason for the Ash.Error?
How can I evaluate what field is missing?

Thanks for your reply, Heiko

Most Liked

Chrichton

Chrichton

Oh my.

Thank you again Rebecca.
Again you are right :sweat_smile:

And you are faster than lightning!

It works and now my admin tool for Artists and Albums is complete.

I promise not to ask anything today :innocent:

Have a nice Saturday.

Best wishes from Heiko

Where Next?

Popular in Questions Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

We're in Beta

About us Mission Statement