# Debug a missing dependency

A package declares required dependencies through the arguments to its build
functions. When Kix cannot resolve one of those arguments, evaluation stops
before any manifests are deployed.

## Read the missing argument

Run the cluster checks:

<Command {...check} />

The diagnostic identifies `backend` as the unresolved build argument and
names the consuming instance's namespace. Start with that argument name, not
the Kubernetes resources the package would have rendered.

## Check the package declaration

Find the build entry that accepts the missing argument:

```nix title="packages/gateway/default.nix"
build = { backend, ... }: {
  # Resources that read backend.out values.
};
```

An argument without a default is required. An argument such as
`backend ? null` is optional and does not cause this error when no provider is
available.

## Check the available instances

Kix first looks for an eligible instance with the same name or alias in the
consumer's namespace. Check the cluster definition for spelling changes and
for an instance that was removed or moved.

If the intended provider has another name or lives in another namespace, wire
it explicitly:

```nix title="cluster.nix"
instances.apps.gateway = {
  package = packages.gateway;
  deps.backend = ref.platform.api;
};
```

The key after `deps` must match the build argument. The reference selects the
provider by namespace and instance name.

Run the checks again after correcting the name or wiring:

<Command {...checkFixed} />

If Kix reports several matches instead, add an explicit `deps` entry to the
consumer that needs one of them. This does not resolve the phase-1 ambiguity by
itself, because that pass does not read explicit dependency overrides. One of
the providers must also have a unique alias. See
[Use aliases and default aliases](/docs/v0.1/how-to/debug-dependency-wiring/use-aliases-and-default-aliases/)
for that shape.

:::note[Explanation]
See [Dependency resolution and why explicit deps matter](/docs/v0.1/explanation/dependency-resolution-and-why-explicit-deps-matter/)
for the complete lookup order.
:::

:::note[Reference]
See [Build entries](/docs/v0.1/reference/package-schema/build-entries/) and
[`deps`](/docs/v0.1/reference/instance-schema/deps/) for the two sides of the
wiring contract.
:::