# DPiFn::type-mismatch


**Key:** `DPiFn::type-mismatch`

**Category:** indexing · **Severity:** error

**Source:** [`src/diag/hints.nix:874`](https://github.com/kleisli-io/nix-effects/blob/main/src/diag/hints.nix#L874)

the index selector's domain must match the declared sort `S`

## Example

`Hint::DPiFn::type-mismatch` means the `DPiFn` position supplies a term whose type does not match the expected type. The example shows the failing form first, then one way to give the checker the missing structure.

```nix
# Bad: the selector domain does not match the declared sort.
descPi nat (s: stringIndex) (_: descRet stringIndex)

# Better: the selector consumes the same sort descPi declares.
descPi nat (n: natIndex n) (_: descRet (natIndex n))

```


---

[← All diagnostic hints](/nix-effects/diag-hints)
