Skip to content

Fix: Error NU1301: Unable to load the service index for source

  • by
  • 3 min read
What is Metadata? Types and benefits | Candid.Technology

Programming has become far easier than it was a few years ago. However, there are random bugs and glitches that developers have to face just about every day that pop up out of nowhere. Anything from a missed comma to an incorrect IDE setting can cause a host of problems. 

In this article, we’re talking about the “Error nu1301: unable to load the service index for source” issue, its causes and what you can do to fix the problem. 

What causes “Error nu1301: unable to load the service index for source”?

You might run into this kind of error for a few reasons. The most common factors are as follows:

  • Corrupt or incorrect configuration files
  • Your Personal Access Token (PAT) has expired
  • Bugs in your IDE

Also read: Fix: Unknown error: soap-error: encoding: object has no uirequestid property

How to fix “Error nu1301: unable to load the service index for source”?

Here are three fixes you can try out.

Use a proper NuGet config file 

An incorrect or incomplete NuGet configuration file can cause all sorts of problems. Your configuration file should have everything required for your project to run, including any dependencies. Here’s the basic NuGet configuration file for you to get started.

<?xml version="1.0" encoding="utf-8"?>
    <clear />
    <add key="NuGet Public" value="" />
Top 7 IDEs and Text Editors to code Python, Java, C++, HTML and more

After updating your configuration file, restart the project and it should work fine. Alternatively, you can also delete your NuGet configuration file entirely and restart your IDE. That should generate another configuration file with all the settings required. 

Run dotnet restore

If you’re using Visual Studio Code, running the dotnet restore command in interactive mode is another way the issue can be resolved. Just open a terminal within your IDE and run the following command. 

dotnet restore --interactive

Restart the project and the error should be gone. 

Check your PAT 

Last, but not least, check to see if you’re using a valid PAT and that it isn’t expired. This is even more important if you’re pulling data from private repositories or want to work on a problem independently from the entire project. 

You can generate a new PAT whether you’re using Azure, Github or any other repository database and update your configuration file accordingly. Once done, restart the project and check if the problem is solved. 

Also read: How to fix Docker exec format error? 


Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here: [email protected].