How-to › Model, configure and generate

How to read a contradiction error and find both values that clash#

Turn an aontu vet failure into the two positions that clash, follow the include chain to the value an environment set, and fix that file, not the shared definition.

Audience
Platform team
Level
beginner
Topic
Unify configuration with a spec language
Verified

The deploy job’s evaluation of production fails with Cannot unify values at path $.server.port. Its first frame points at the shared definition every service uses, so the obvious edit lowers the port bound there. The value that clashed sits in a file production reaches through three includes, and lowering the bound makes every environment accept port 80.

What you get

You will end up with both positions of a clash and the include chain that reached each one. A test then tells a fix in the right file from one that loosens the shared rule. This is for you if a layered config fails at a line you did not change.

Short answer

Run aontu vet with the shared definition as the schema and one environment’s entry file as the data. Each finding names two sites: data, the value the environment supplied, and schema, the definition it failed. Follow the data site’s include chain from the entry file and edit that value. Loosening the schema line also clears the error, but it changes the rule for every environment that shares the definition.

You will need

Node 22 or later, and aontu installed from npm in the config’s directory. Verified 2026-11-30 against Node 22.23.5 and aontu 0.76.3. The aontu package and its @tabnas dependencies declare engines.node as >=24, so npm ci prints EBADENGINE warnings under Node 22 and installs them anyway. Every command here calls node_modules/.bin/aontu, so a different aontu on your PATH never answers.

Approaches compared

ApproachWhen it fitsWhat it costs youWhen to pick something else
aontu vetThe layers are aontu files, and you want each site labeled as data or schemaAnother language for contributors, and a data site that named no entry file on this configThe config already lives in CUE or Nickel, where both positions print too
CUE cue vetThe config is CUE, with the layers listed as files on the command lineTwo positions with no label on this clash, so you decide which one is the definitionYou want the report itself to say which side an environment supplied
Dhall dhall typeThe config is Dhall, and types plus assert expressions are the checks you needNo number type takes a range, and the tutorial’s assertion error gives one source position for both valuesThe clash is between two values, and you need both positions printed
Nickel contractsThe config is Nickel, with a schema record of contracts merged over the layersNamed the last field, port, rather than the path, beside both file positions hereSeveral records share a field name, so the path decides which one broke

aontu and Nickel printed both positions of this clash, and so did CUE, with no label on either line. Nickel named only the last field, which is cheap to read until two records both hold a port. The number types in the Dhall standard take no range, so a port rule becomes an assert you write, and the tutorial’s failed assertion shows one source position under an import chain.

Voxgig maintains aontu. It is one of four options here, not the recommendation.

Read the error the deploy job prints

The sample config has a shared definition, defs/service.aontu, with port: integer & min(1024) & max(65535),1 and three environments under envs/. deploy-prod.aontu includes the definition and production’s entry file, which is what a deploy job evaluates. The full error carries a hint and a source frame for each side, so this filters it to the positions:

node_modules/.bin/aontu deploy-prod.aontu 2>&1 | grep -E 'Cannot unify value|-->'
[aontu/constraint]: Cannot unify values at path $.server.port
 Cannot unify value: integer&min(1024)&max(65535) with value: 443
  --> defs/service.aontu:3:19
 Cannot unify value: 443 with value: integer&min(1024)&max(65535)
  --> envs/lb/hotfix-443.aontu:2:15

Both sides are there. The definition comes first, and it is the file most readers recognize, so it is the one they open. Read the second frame before you edit anything: it names the value, 443, and the file that wrote it.

Ask vet which side an environment supplied

aontu vet takes the definition and the data as separate arguments, so it can label each site by where it came from:

node_modules/.bin/aontu vet defs/service.aontu envs/prod.aontu
verdict: invalid

$.server.port: constraint [conflict]
  [aontu/constraint]: Cannot unify values at path $.server.port
  expected: integer&min(1024)&max(65535)
  actual:   443
  data: envs/lb/hotfix-443.aontu:2:15 (443)
  schema: defs/service.aontu:3:19 (integer&min(1024)&max(65535))

The order has flipped. The reference documents it: vet lists the data site first because that is the one to edit.2 It exits 1 for a contradiction, and --format json gives the same two sites as objects with file, row, col and role.

The data site names envs/lb/hotfix-443.aontu. Nothing in envs/prod.aontu mentions that file, and vet does not print how it was reached.

Follow the include chain to the value

clash.mjs runs vet once per environment and reads the JSON report. It walks the includes of each entry file breadth first, recording the file that included each one, so it can print the chain back to the entry. Then it compares the files it found with the list aontu’s own parser returns for that entry:

export function includeTree(entry) {
  const root = resolve(entry)
  const parent = new Map([[root, null]])
  const queue = [root]
  while (queue.length > 0) {
    const file = queue.shift()
    if (!existsSync(file)) throw new Error(`include not found: ${file}`)
    const text = readFileSync(file, 'utf8').split('\n').map(stripComment).join('\n')
    for (const m of text.matchAll(INCLUDE)) {
      const spec = m[1] ?? m[2] ?? m[3]
      if (BUNDLED.test(spec)) continue
      const child = resolve(dirname(file), spec)
      if (!parent.has(child)) {
        parent.set(child, file)
        queue.push(child)
      }
    }
  }
  const walked = [...parent.keys()].filter((f) => f !== root).sort()
  const loaded = [...new Set(engineIncludes(root))].sort()
  if (walked.join('\n') !== loaded.join('\n')) {
    throw new Error(`the walker and aontu disagree on the includes of ${entry}`)
  }
  return parent
}

A missing include throws, and so does a file list that differs from the parser’s, because a short or wrong chain points at the wrong owner. Run it over all three environments:

node clash.mjs defs/service.aontu envs/dev.aontu envs/staging.aontu envs/prod.aontu
envs/dev.aontu  valid
envs/staging.aontu  valid
envs/prod.aontu  invalid
  $.server.port  constraint
    data   envs/lb/hotfix-443.aontu:2:15  443
      via envs/prod.aontu > envs/regions/eu-west.aontu > envs/lb/public.aontu > envs/lb/hotfix-443.aontu
      reached by 1 of 3 environments, 0 of the others vet valid
    schema defs/service.aontu:3:19  integer&min(1024)&max(65535)
      reached by 3 of 3 environments, 2 of the others vet valid

Two environments meet the same definition and pass, so the definition alone produces no clash. hotfix-443.aontu is reached by production only, three includes from its entry file. That file is the one to change, and the chain shows which layer brought it in: the load balancer layer.

Check it worked

fixes.mjs applies each candidate fix to a scratch copy, then vets production and an overlay that asks for port 80:

node fixes.mjs
loosen the shared definition: defs/service.aontu, min(1024) -> min(1)
  envs/prod.aontu      valid
  a port 80 overlay    valid
change the hotfix production reaches: envs/lb/hotfix-443.aontu, port: 443 -> port: 8443
  envs/prod.aontu      valid
  a port 80 overlay    invalid

Both fixes turn production valid, but the first also accepts port 80, which the definition exists to refuse. The test pins the two positions, the chain, the result of each fix, and the walker’s answer for each include form aontu loads:

node --test clash.test.mjs
1..12
# tests 12
# suites 0
# pass 12
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 5566.302667

When it goes wrong

A later environment binds a port the definition used to refuse, after a fix that turned the build green. Someone edited the schema site because it came first in the evaluation error. Revert it, and edit the data site the vet report names.

Vet given several data files reports a data site with no entry file. With envs/dev.aontu envs/staging.aontu envs/prod.aontu in one call, the finding still names only envs/lb/hotfix-443.aontu. Vet one entry per call, as clash.mjs does, so each verdict belongs to one environment.

The walker stops with the walker and aontu disagree. The entry uses an include form the walker does not read, or a string holds text shaped like an include. Read the entry by hand, then teach the walker the form and add a test for it.

Read the same clash in three other languages

record.sh ran the same layers, written in CUE and in Nickel, once each. The page’s checks read what they printed rather than running either tool:

cat records/cue-vet.txt
# cue version v0.18.0
# exit status 1
server.port: invalid value 443 (out of bound >=1024):
    ./defs/service.cue:5:17
    ./envs/lb/hotfix-443.cue:4:15
cat records/nickel-export.txt
# nickel-lang-cli nickel 1.18.0 (rev cargore)
# exit status 1
error: contract broken by the value of `port`
  ┌─ defs/service.ncl:5:12
  │
5 │     port | Port,
  │            ---- expected type
  │
  ┌─ envs/lb/hotfix-443.ncl:2:17
  │
2 │ { server.port = 443 }
  │                 ^^^ applied to this expression

CUE printed the path and both positions, with nothing to say which is the definition. Nickel labeled the two as expected type and applied to this expression, which does the job vet’s roles do, and named the field as port alone. Neither printed an include chain. CUE has none to print, since every layer is on its command line. Nickel reached hotfix-443.ncl through three imports from prod.ncl and named neither prod.ncl nor the files between.

A position can still go missing. Nickel’s guide to blame locations shows a contract that checks a whole record at once, and its error blames the record rather than the field inside it.

Dhall was not run. Its tutorial shows a failed assert in an imported file as an ↳ ./test.dhall line, the message Error: Assertion failed, and a diff of the two normal forms. It then gives the failing expression’s position, ./test.dhall:7:16, and the import’s, (input):1:1.3

When not to do this

Do not loosen a shared definition to clear one environment’s error. The definition is a rule every environment meets, and the two passing environments show the rule holds.

Do not move a CUE or Nickel config into aontu for the data and schema labels. Both tools printed the same two positions here, so the label is all the move would buy.

Do not trust a chain walker that reads includes with a regular expression and never checks itself. aontu loaded single quotes, backticks and a space after the @ here, and the walker only knows the forms its test lists. The comparison with the parser’s own list is what catches the next one.

Do not vet every environment in one call when you need to know which one failed. Pass one entry per call, or use --format json and keep the entry beside each report.

Last verified

Verified 2026-11-30 against Node 22.23.5 and aontu 0.76.3, installed from npm in the sample directory. Every output block is what the command preceding it printed. The CUE and Nickel records came from cue v0.18.0 and Nickel 1.18.0, run once by record.sh; the page’s checks do not run them. Dhall was not run: everything said about it here is read from its tutorial and its language standard.

Footnotes

  1. The floor of 1024 is the edge of a range. RFC 6335 divides each transport’s 16-bit port space into System Ports from 0 to 1023, User Ports from 1024 to 49151, and Dynamic Ports from 49152 up. It cites RFC 1340 for the split. Each range carries more than one name, so 443 is a System Port and a Well Known Port at once. ↩︎ Back to text

  2. The vet reference contrasts that order with the source order a single-document error follows. One clash therefore prints its two sites in two orders, depending on whether vet or a plain evaluation found it, as the first two commands on this page show. ↩︎ Back to text

  3. The arrow is how Dhall draws an import chain. The same tutorial uses it for a cycle, with ↳ ./file1 followed by an indented ↳ ./file2 and then Cyclic import: ./file1, so the chain makes up most of the error. ↩︎ Back to text

Read this page as markdown · All how-to guides

Generate the client instead of writing it#

Retries, timeouts, pagination and auth are the same problems in every client. Voxgig generates them from your OpenAPI description, in 23 languages, from one model.

Listen to Fireside, the Voxgig podcast

Since 2018, Richard Rodger has talked with developer advocates, event organizers, and the people who build developer-facing companies about the specifics of the work.