ash read_one bug?

https://hexdocs.pm/ash/Ash.html#read_one/2-examples Ash.read_one(Submission, id: submission_id) does not work
{:error,
%Ash.Error.Unknown{
errors: [
%Ash.Error.Unknown.UnknownError{
error: "** (Spark.Options.ValidationError) unknown options [:id], valid options are: [:not_found_error?, :page, :load, :max_concurrency, :lock, :return_query?, :skip_unknown_inputs, :reuse_values?, :strict?, :authorize_with, :domain, :timeout, :tracer, :action, :authorize?, :context, :tenant, :actor, :scope]",
field: nil,
value: nil,
splode: Ash.Error,
bread_crumbs: [],
vars: [],
path: [],
stacktrace: #Splode.Stacktrace<>,
class: :unknown
}
]
}}
{:error,
%Ash.Error.Unknown{
errors: [
%Ash.Error.Unknown.UnknownError{
error: "** (Spark.Options.ValidationError) unknown options [:id], valid options are: [:not_found_error?, :page, :load, :max_concurrency, :lock, :return_query?, :skip_unknown_inputs, :reuse_values?, :strict?, :authorize_with, :domain, :timeout, :tracer, :action, :authorize?, :context, :tenant, :actor, :scope]",
field: nil,
value: nil,
splode: Ash.Error,
bread_crumbs: [],
vars: [],
path: [],
stacktrace: #Splode.Stacktrace<>,
class: :unknown
}
]
}}
But,
iex(36)> Submission |> Ash.Query.filter(id == ^submission_id) |> Ash.read!()
[debug] QUERY OK source="submission" db=1.2ms idle=1161.2ms
SELECT s0."id", s0."status", s0."file_path", s0."user_id", s0."error_message", s0."submitted_at" FROM "submission" AS s0 WHERE (s0."id"::uuid = $1::uuid) ["25108688-7e39-490a-8ef2-2903a8f1f7e7"]
↳ anonymous fn/3 in AshPostgres.DataLayer.run_query/2, at: lib/data_layer.ex:788
[
%AnswerMentor.Documents.Submission{
id: "25108688-7e39-490a-8ef2-2903a8f1f7e7",
status: "ocr_failed",
submitted_at: ~U[2025-06-28 02:18:30.989587Z],
file_path: "./data_dir/001.pdf",
error_message: "OCR \"}\"",
user_id: "dc064913-8caf-4afd-8638-40b532cad840",
user: #Ash.NotLoaded<:relationship, field: :user>,
submission_pages: #Ash.NotLoaded<:relationship, field: :submission_pages>,
answer: #Ash.NotLoaded<:relationship, field: :answer>,
__meta__: #Ecto.Schema.Metadata<:loaded, "submission">
}
]
iex(36)> Submission |> Ash.Query.filter(id == ^submission_id) |> Ash.read!()
[debug] QUERY OK source="submission" db=1.2ms idle=1161.2ms
SELECT s0."id", s0."status", s0."file_path", s0."user_id", s0."error_message", s0."submitted_at" FROM "submission" AS s0 WHERE (s0."id"::uuid = $1::uuid) ["25108688-7e39-490a-8ef2-2903a8f1f7e7"]
↳ anonymous fn/3 in AshPostgres.DataLayer.run_query/2, at: lib/data_layer.ex:788
[
%AnswerMentor.Documents.Submission{
id: "25108688-7e39-490a-8ef2-2903a8f1f7e7",
status: "ocr_failed",
submitted_at: ~U[2025-06-28 02:18:30.989587Z],
file_path: "./data_dir/001.pdf",
error_message: "OCR \"}\"",
user_id: "dc064913-8caf-4afd-8638-40b532cad840",
user: #Ash.NotLoaded<:relationship, field: :user>,
submission_pages: #Ash.NotLoaded<:relationship, field: :submission_pages>,
answer: #Ash.NotLoaded<:relationship, field: :answer>,
__meta__: #Ecto.Schema.Metadata<:loaded, "submission">
}
]
does work
3 Replies
sevenseacat
sevenseacat6mo ago
yeah thats not valid syntax
ZachDaniel
ZachDaniel6mo ago
Oops. Can someone PR the removal of that first example?
Abhishek
AbhishekOP6mo ago
GitHub
chore: remove incorrect docs by TwistingTwists · Pull Request #217...
Contributor checklist Leave anything that you believe does not apply unchecked. Bug fixes include regression tests Chores Documentation changes Features include unit/acceptance tests Refactor...

Did you find this page helpful?