Duolith docs

Errors while checking a page

E0175 Screen or markup feature in a behaviour

Message what has no place in a behaviour: it has no markup and is not a screen

Words in italics are filled in when the compiler reports it, such as the element's name or the list of known ones.

Why

A behaviour is script that runs inside the file that calls it (decision 0152). props() belongs to a component, which is placed with them; guard() belongs to a page or layout, which the router shows; a component can only be placed by a file with markup. State, a derived value, an effect or a behaviour's result made at a behaviour file's top level, anywhere outside a function (let a = 1, shared = state(0), or const box = { s: state(0) }), would run once and be one value shared by every caller, which is never what a behaviour means.

How to fix it

Take props and place components in the component that calls the behaviour, and pass what the behaviour needs as its input; call guard() in the page. Make state inside the behaviour function, so each caller gets its own; to share one value on purpose, use state(initial, { shared: "name" }) inside it.

In a terminal

duolith explain E0175

Mentioned in