---
title: "Find dead entries"
description: "Report map entries whose removal changes nothing, so layered files do not silt up with lines a template already implies."
source: "https://aontu.dev/how-to/find-dead-entries/"
---

# Find dead entries

Report map entries whose removal changes nothing, so layered files do not silt up with lines a template already implies.

Rendered from [`docs/how-to/find-dead-entries.md`](https://github.com/aontu-lang/aontu/blob/main/docs/how-to/find-dead-entries.md) in the engine repository, where a correction belongs, and where the test suite executes every example on this page.

Layered files silt up: an entry written before the template existed now repeats what the template already says, and deleting it by eye is a bet. `aontu trim --check` settles the bet by evaluation: each map entry is deleted in turn, the document re-evaluated, and the entries that made no difference are reported as paths. Write `services.aon`:

```aontu
services: {
  &: { tier: standard }
  auth:    { tier: standard, replicas: 3 }
  billing: { replicas: 1 }
}
```

Now check it:

```sh
$ aontu trim --check services.aon
verdict: redundant

$.services.auth.tier
$ echo $?
1
```

`auth.tier` restates the `&:` template, so the document means the same thing without it. The test is evaluate-and-compare, not pattern matching, which covers everything the fixpoint can see: spread templates, references, duplicate-key merges. (A removal that makes the document _error_ is not redundant: the document does not stand up without that entry.)

Delete the dead line yourself (trim only reports) and re-declare `services.aon`:

```aontu
services: { &: { tier:standard } auth:replicas:3 billing:replicas:1 }
```

```sh
$ aontu trim --check services.aon
verdict: clean
$ echo $?
0
```

Exit `0` is `clean` and exit `1` is `redundant`, so the verb gates a lint job as it stands; `--format json` gives the paths as a `redundant` array. Two limits to know: list elements are never candidates (removing one renumbers the rest, a different document rather than a leaner one), and `--check` is required: a bare `aontu trim` that silently did something other than trimming would be worse than refusing.

The candidate rules and the `error` verdict’s report shape are under [`aontu trim`](https://aontu.dev/docs/reference-api#aontu-trim). Run it beside your schema gate when you [validate in CI](https://aontu.dev/how-to/validate-in-ci); when a reported path surprises you, [explain the value](https://aontu.dev/how-to/explain-a-value) to see which template is doing the implying.
