Duolith docs

Errors E0500 to E0599

E0586 Key a build cannot know

Message a build-time load's key must be text or a list of text, numbers and route parameters

Why

The build calls the loader once per address with the key, and writes the value under it in the seed, so the key must be known at build: a text literal, such as "posts", or a list of literals and the route's own parameters, such as ["post", id], where id is unpacked from route(). A key built from state or another value would only be known when the screen runs.

How to fix it

Write the key as text or as a list such as ["post", id], or load when the screen opens instead of at build.

In a terminal

duolith explain E0586

Mentioned in