# Working with code R005

**R005 - Unable to load class**

The output code R005 generally means that we tried to load a class (e.g. a parameter type) in order to write a test, but failed to do so. This can occur in the context of unit tests for Spring, Java Enterprise Edition (and a few other examples) since some Maven/Gradle dependencies are not available at `test` scope.

An additional reason that classes fail to load can be when the class in question has previously caused an R006 because the static initializer failed to run - often because it attempted to perform an I/O operation that Cover blocked, or timed out. If you've also seen an R006 for the same class then try to address that first by minimizing static initializer logic.

## What’s a scope?

A Maven `pom.xml` file or a Gradle build script (`build.gradle` or `build.gradle.kts`) specifies the steps necessary to create a software artifact from the source code. This includes managing the dependencies on third-party libraries and frameworks.\
\
Both Maven and Gradle allow us to define different groups of dependencies. These dependency groups are called "scopes" in Maven and "configurations" in Gradle. Diffblue Cover uses `test` scopes / configurations.

## Maven Scope Dependencies

The dependency scopes available to Diffblue are: `compile (default)`, `runtime`, `test` and `provided`. However, the `provided` scope is not transitive, which may be a cause of R005 errors. If Diffblue Cover reports that a class indirectly included by a dependency is missing, you can try to resolve this issue by including an additional reference to this indirect dependency at `test` scope.

For further information on Maven dependency scopes, please see: [Maven dependencies](https://maven.apache.org/pom.html#Dependencies)

## Gradle Configuration Dependencies

Again, you must use the correct dependency configurations to avoid receiving the output code R005.

For further information on Gradle dependency configurations, please see: [Gradle Configuration Dependencies](https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.Configuration.html)


---

# Agent Instructions: 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:

```
GET https://cover-docs-preview.diffblue.com/features/output-codes/working-with-output-codes/working-with-code-r005.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
