> For the complete documentation index, see [llms.txt](https://docs.flxbl.io/flxbl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flxbl.io/flxbl/sfp/faqs/common-errors/troubleshooting-unlocked-packages-build-failure-due-to-code-coverage.md).

# Troubleshooting Unlocked Packages Build Failure Due to Code Coverage

This page provides information on a common issue encountered when building unlocked packages in Salesforce that do not contain any Apex code but still fail due to code coverage requirements.

## Possible Causes and Solutions

1. **`unpackagedMetadata` or `apexTestAccess` properties**: Check if you are using the `unpackagedMetadata` or `apexTestAccess` properties on the package in `sfdx-project.json`. In this case, these properties were not used.
2. **Snapshot build org**: If you are using a snapshot build org and have deployed Apex classes to the initial scratch org that you made a snapshot of, then Salesforce will execute Apex tests (`RunAllLocalTests`). However, Salesforce probably wouldn't run the apex tests at all if there were none in the package you were verifying.
3. **Creating a class and testing it**: As a workaround, you can create a class and test it. This seems to be a bug, but it's not confirmed.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.flxbl.io/flxbl/sfp/faqs/common-errors/troubleshooting-unlocked-packages-build-failure-due-to-code-coverage.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
