ash-project / ash-project/ash

Typo in datalayer produces somewhat cryptic error messages (and compile deadlocks if using extensions)

Open
#791 2 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

**Describe the bug**
```
== Compilation error in file lib/safari/virtual/resources/cesium_asset_file_copy.ex ==
** (ArgumentError) could not load module AshPostgres.Datalayer due to reason :nofile
(elixir 1.15.6) lib/code.ex:1888: Code.ensure_compiled!/1
(ash 2.15.6) lib/ash/data_layer/data_layer.ex:395: Ash.DataLayer.source/1
/Users/olivermt/code/safari/app/lib/safari/virtual/resources/cesium_asset_file_copy.ex:1: (file)
(stdlib 5.1.1) erl_eval.erl:750: :erl_eval.do_apply/7
(stdlib 5.1.1) erl_eval.erl:494: :erl_eval.expr/6
(stdlib 5.1.1) erl_eval.erl:136: :erl_eval.exprs/6
(stdlib 5.1.1) erl_eval.erl:282: :erl_eval.expr/6
```

If you add an extension it just goes into deadlock and the compile never finishes, I only discovered the nofile thing when I removed the AshOban extension.

**To Reproduce**
Misspell datalayer like `data_layer: AshPostgres.Datalayer` (lower case l)

**Expected behavior**
Tell me that I am specifying a data layer that does not exist, :nofile sounds like it can be anything even though in **hindsight** it makes to be nofile due to my typo

**Runtime**
- Ash version 2.15.6

Contributor guide

Open the contributing guide

Research direction

Start with lib/ash/data_layer/data_layer.ex, especially the Ash.DataLayer.source/1 path shown in the stack trace, and reproduce the issue with data_layer: AshPostgres.Datalayer. The change is complete when a misspelled data layer produces a clear missing-data-layer error instead of :nofile and adding an extension no longer leaves compilation in a deadlock.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.