For "prefixLenght" in option->networking, What does it mean with "used but not defined"

If I define a route like this:

networking.interfaces.wlp0s20f3.ipv4.routes = [{
    address = "1.2.3.4";
    via = "5.6.7.8";
  }];

, then I get

error: The option `networking.interfaces.wlp0s20f3.ipv4.routes."[definition 1-entry 1]".prefixLength' is used but not defined.
(use '--show-trace' to show detailed location information)

If I try to specify

prefixLength = "24";

, then I get:

error: A definition for option `networking.interfaces.wlp0s20f3.ipv4.routes."[definition 1-entry 1]".prefixLength' is not of type `signed integer'. Definition values:
       - In `/etc/nixos/configuration.nix': "24"
(use '--show-trace' to show detailed location information)

The first snippet triggers nix code that uses prefixLength, so the error effectively means you need to define it, as you did correctly.

The second error includes the phrase

is not of type `signed integer’

because the option in question requires an integer, not a string. So if you set

prefixLength = 24;

You should be fine.

Right;) Thanks, but I still get an error after it has run

okt. 31 09:44:10 ximian network-addresses-wlp0s20f3-start[2003582]: adding route 1.2.3.4/24... 'ip route add  1.2.3.4/24  via 5.6.7.8 dev wlp0s20f3' failed: Error: Invalid prefix for given prefix length.
okt. 31 09:44:10 ximian systemd[1]: network-addresses-wlp0s20f3.service: Main process exited, code=exited, status=1/FAILURE
okt. 31 09:44:10 ximian systemd[1]: network-addresses-wlp0s20f3.service: Failed with result 'exit-code'.
okt. 31 09:44:10 ximian systemd[1]: Failed to start Address configuration of wlp0s20f3.
warning: error(s) occurred while switching to the new configuration

I commented on the nixos options aspects, because I am not entirely sure what you are trying to do here considering that your IP addresses seem to be place holders? If you are literally using 1.2.3.4, that’s a full IPv4 address, so the prefixLength should probably be 32 then. If you’d like to use a prefixLength of 24, use an IP with that many bits set, e.g. 1.2.3.0. Or so, hard to be sure for me without context

You’re absolutely right;) I should’ve seen both this one and the last one;) Thanks.