Factory "user" not found, hint says Known factories: (none), but the file exports it
Example threads. These questions and answers were written by the SDODS team to document real problems and how to fix them. The people named are illustrative, not real users. Questions asked on this site are marked new.
gherkin
Given I generate a "user" from the factory as "newUser"
text
DATASET_NOT_FOUND: Factory "user" not found.
hint: Known factories: (none). Define it in data/factories.ts.
projects/shop/data/factories.ts exists and exports a user. The hint even names the file it says I should create.
Known factories: (none) means the map came back empty, not that the name is wrong. There are two ways to get an empty map and neither of them is a missing file:
data.factories is not set in sdods.project.yaml. With no path configured the loader returns an empty map without looking at anything, and the fallback text in the hint is a suggestion, not the path it tried.
The path is set, the file is there, but it does not default-export the map. A named export const user = ... is not found — the loader takes default or a named factories export.
And the path resolves against the project root, not the repo root, so ./data/factories.ts means projects/<slug>/data/factories.ts. We had it pointing one directory too high for a month and never noticed because the empty map is not an error.