ash-project / ash-project/ash

Inconsistent option `error?` vs `not_found_error?` for `Ash.get()` vs `get? true` in action?

Open
#2,569 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Elixir
Stars
2.5k
Forks
422
Avg merge
23h 26m
Merged PRs (30d)
46

Description

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

### AI Policy

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

### Versions

Ash: 3.15

### Operating system

ubuntu

### Current Behavior

I'm not sure it's a bug or by design but I noticed that the options for "don't return an error if no record is found" is different between `Ash.get` vs a read action with `get? true`:

```ex
# Using Ash.get():
Ash.get(SomeResource, error?: false) # <-- here its `error?`

# Using a read action in a resource:
defmodule MyResource do
actions do
read :some_action do
get? true
end
end
end

MyResource.some_action(not_found_error?: false) # <-- here its `not_found_error?`
```

They seem to be doing the same thing, so shouldn't they use the same option?

### Reproduction

_No response_

### Expected Behavior

_No response_

Contributor guide

Open the contributing guide

Research direction

Compare the Ash.get/2 call using error?: false with the read action using get? true and MyResource.some_action/1 using not_found_error?: false. Trace where each option is defined and handled, then check the related tests or documentation if present; done means the equivalent APIs use a consistent option name and their behavior remains covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
backend
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.