Jadpo is experimental and not ready for production. These docs follow the compiler's main branch as of 5 Nov 2026. What's built · Install 0.3.0
jadpo
ReferenceErrors

ErrorsStandard library · rule

type.argument_negative

On this page

A list or text operation is given a count or a position that might be negative.

Area 19, Standard library; not declinable; the next step is usually the agent's.

Why Jadpo refuses it

A count or a position is never negative in Jadpo: list.at's position, slice's from and count, and the n of keep_first, keep_last, drop_first and drop_last. In JavaScript a negative position counts back from the end, so an off-by-one quietly reads the wrong item. Jadpo has no such meaning, so it proves the number's sign while compiling.

A literal passes when it isn't below 0. A value passes when its type has a min of at least 0. Anything else might be negative, so it is refused.

What it looks like

main.jadpo:

example
type BatchName = Text {    min_length: 1}type TraysOut = Int {}/// The batches still to bake once `done` of them are out of the oven.function still_to_bake(bakings: List<BatchName>, done: TraysOut) -> List<BatchName> {    return list.drop_first(bakings, done)}
jadpo checkcheck failed: 1 error, 1 file

error done may be negative

--> main.jadpo:9:37

  |9 |     return list.drop_first(bakings, done)  |                                     ^^^^ `TraysOut` can be below `0`
reason
list.drop_first's n counts from the start, so it is never negative, which is proved while compiling: a literal isn't below 0 and a value's type has a min of at least 0; TraysOut allows values below 0.
next
Pass a value whose type has min: 0, building it where a negative one is handled; count from the end with keep_last or drop_last (agent)
rule
type.argument_negative
help
https://jadpo.dev/docs/errors/type.argument_negative

(agent) at the end of the next: line means your coding agent can make the fix itself.

How to fix it

If the count is never negative, say so on its type with min: 0:

example
type TraysOut = Int {    min: 0}

done can no longer be below 0, so drop_first always drops from the start. A TraysOut built from a computed number is checked against min: 0 where it is built, so a negative number is handled there.

A result such as list.count's is a plain Int, which proves nothing about its sign. Build it into a type with min: 0 before you pass it. To count from the end of a list, use keep_last or drop_last with a count that isn't negative.

Markdown for agents: /docs/errors/type.argument_negative.md.Built from Jadpo main at aee2e8f.