Skip to content

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.

Run the cluster checks:

Run in kix-examples/ Output excerpt
❱ kix check 06-service-dep
error: dependency 'backend' was not found for namespace 'tutorial-06'. Add an instance with that name or alias, or set deps.backend explicitly.
(exit code: 1)

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.

Find the build entry that accepts the missing argument:

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.

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:

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:

Run in kix-examples/
❱ kix check 06-service-dep
 TOOL         RESULT  DETAILS                                                       
 eval         pass    14 manifests evaluated                                        
 kubeconform  pass    skipped (this validation tool is not yet integrated with Kix) 
 pluto        pass    skipped (this validation tool is not yet integrated with Kix) 
 kyverno      pass    skipped (this validation tool is not yet integrated with Kix) 
 scorecard    pass    0 errors, 9 warnings, 2 info

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 for that shape.