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

ErrorsValues and types · rule

type.mismatch

On this page

A value of one type is used where a different type is required.

Area 2, Values and types; not declinable; the next step is usually the agent's.

Why Jadpo refuses it

Every named type says what its values mean and which rules they follow. A value can stand in only for its own type, or for a type it builds on. Going the other way, such as from a plain Int to a Stock, always goes through a constructor, which checks the target's rules, so a value never takes on a type whose rules nobody checked.

What it looks like

main.jadpo:

example
type Stock = Int {    min: 0}function add(a: Stock, b: Stock) -> Stock {    return a + b}
jadpo checkcheck failed: 1 error, 1 file

error Int can't be used where Stock is required

--> main.jadpo:6:12

  |6 |     return a + b  |            ^^^^^ this is `Int`
reason
Arithmetic works on the representation, so this is a plain Int; only Stock(...) makes it a Stock, checking its rules.
next
Convert it with Stock(a + b) (agent)
rule
type.mismatch
help
https://jadpo.dev/docs/errors/type.mismatch

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

Where an object is required, the error shows its shape and the value written out. A text goes in the one field the object must have, as an edit your coding agent can apply, and a standard type's page is one command away:

example
function author() -> PersonName {    return "Frank Herbert"}
jadpo checkcheck failed: 1 error, 1 file

error "Frank Herbert" can't be used where PersonName is required

--> main.jadpo:2:12

  |2 |     return "Frank Herbert"  |            ^^^^^^^^^^^^^^^ the wrong kind of value
reason
This is text, and PersonName is an object: PersonName { given: GivenName, family: FamilyName? }.
next
Write PersonName { given: "Frank Herbert" }, and see jadpo help PersonName for the type (agent)
rule
type.mismatch
help
https://jadpo.dev/docs/errors/type.mismatch

A second error with the same reason keeps its place and its own edit, and its reason: says As the first `type.mismatch` above. jadpo check --full writes every reason out, and --json gives the place of the first in sameAs.

How to fix it

If the value should become the required type, convert it with that type's constructor:

example
    return Stock(a + b)

The sum is checked against Stock's rules. Here that check can't fail: a and b are never below zero and Stock has no maximum, so their declared ranges prove the sum is a valid Stock. When nothing proves it, the construction starts with attempt and says what happens when it fails.

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