Element cannot be deployed due to an error in its dependency

This pre-deploy error appears when trying to deploy a change, and one of its required dependencies has an error which prevents it from being deployed.

What triggers this error?

This error is triggered when Salto calculates a deploy plan, and identifies a new element which has a required dependency but that dependency can not be deployed due to another error.

For example, a user may try to deploy a new Apex Class in Salesforce which uses some custom object, but that custom object can not be deployed due to a problem with one of its fields.

When this error occurs, Salto will skip this element, and it will not be deployed if user decides to proceed. This is because the element depends on something which can not be deployed.

How can I solve this?

To avoid this error, check which dependency contains the error which prevents your element from being deployed. This information appears in the error message itself.

Once you fix that error, try deploying again, and if the dependency's error has been cleared, the object which depends on it should be OK for deployment as well.