Fixing Maven’s “Malformed \uxxxx encoding” Issue

The “Malformed \uxxxx encoding” error in Maven can occur due to corrupted files, which are used to cache dependency metadata. These files can become corrupted when multiple Maven processes try to access them simultaneously, leading to data inconsistencies.

Understanding the Cause:

  • Concurrency Issues:
    • Concurrent writes during dependency resolution can corrupt the file.
Malformed \uxxxx encoding

The file is a cache file used by Maven to store information about dependency resolution. This information includes the checksums of downloaded JAR files, URLs of remote repositories, and timestamps of when dependencies were last resolved.

The purpose of this cache is to speed up dependency resolution during subsequent builds. By storing this information locally, Maven can avoid downloading the same JAR files multiple times and retrieving repository URLs from the internet. This can significantly improve build performance, especially for projects with large dependency trees.

Step-by-step fix of the issue

To resolve this issue, follow these steps:

  1. Locate the files: Open your terminal or command prompt and navigate to your home directory. Use the following command to find all files:
grep -lrnw ~/.m2 -e '\u0000' | xargs rm

In general, if you want to remove all from your Maven repository, you can run the following command:

find ~/.m2/ -name -delete

What Happens When You Delete the File ?

Deleting the file for a dependency forces Maven to re-download the JAR file for that dependency, as well as retrieve the repository URL from the internet. This can significantly slow down the build, especially for dependencies that are large or have not been updated recently.

However, in some cases, deleting the file can be necessary to resolve dependency resolution issues. For example, if the file is corrupted, Maven may encounter errors when attempting to load it. Deleting the file and letting Maven rebuild the cache can sometimes fix these issues.

Preventive Measures:

  • Limit Thread Usage:
    • Use -Daether.metadataResolver.threads=1 as an option to restrict thread usage during dependency resolution.
    • This prevents concurrent writes that might corrupt the file.


This issue arises from a corrupted dependency file caused by concurrent writes during Maven’s dependency resolution process. Deleting the corrupted file and limiting thread usage can effectively resolve this problem. Apply these steps to maintain a smooth Maven build process without encountering the “Malformed \uxxxx encoding”