Making Tax Digital (MTD) VAT Returns - Localhost and Port 8080 Authentication Errors

Modified on Tue, 9 Jun at 10:41 AM

When submitting a Making Tax Digital (MTD) VAT return in Navigator, you may receive an authentication error referencing:

  • localhost
  • 127.0.0.1
  • Port 8080

You may also encounter an error similar to:

Failed to listen on prefix 'http://localhost:8080/' because it conflicts with an existing registration on the machine.

Or:

Unhandled exception has occurred in your application.

These errors occur during the HMRC authentication process and prevent Navigator from obtaining the authorisation token required to submit VAT returns.

This guide explains:

  • Why the error occurs
  • How Navigator authenticates with HMRC
  • How to diagnose the cause
  • How to resolve the issue
  • Common HMRC error codes
  • When OAuth tokens should be reset

Why This Matters

Making Tax Digital submissions require Navigator to establish a secure connection with HMRC before any VAT obligations can be viewed or returns submitted.

If Navigator cannot complete the authentication process:

  • VAT obligations cannot be retrieved
  • VAT returns cannot be submitted
  • Existing HMRC authorisation may fail
  • Users may be unable to continue with MTD submissions

Understanding the authentication process helps identify whether the issue originates from:

  • Browser settings
  • Local machine configuration
  • Security software
  • Existing OAuth tokens
  • HMRC authentication responses

Understanding How MTD Authentication Works

When Navigator connects to HMRC, it performs an OAuth authentication process.

The process works as follows:

  1. Navigator launches your default web browser.
  2. The browser opens the HMRC sign-in page.
  3. You enter your HMRC credentials.
  4. HMRC generates an authorisation code.
  5. Navigator creates a temporary local listener using:
http://localhost:8080
  1. HMRC redirects the browser back to the local address.
  2. Navigator receives the authorisation code.
  3. Navigator exchanges the code for an access token.
  4. Navigator stores the token for future submissions.

The localhost address never leaves your computer.

It exists purely so Navigator can receive the authorisation response from HMRC.


Error Example

The following error is commonly seen when another process has already claimed port 8080:

Failed to listen on prefix 'http://localhost:8080/' because it conflicts with an existing registration on the machine.

This indicates Navigator attempted to create its local authentication listener but Windows reported the port was already reserved or in use.


Common Causes

Cause 1 - Another Application Is Using Port 8080

Description

Port 8080 is commonly used by:

  • Web services
  • Development tools
  • Local APIs
  • Database management tools
  • Monitoring utilities
  • VPN software

If another process has already claimed the port, Navigator cannot start the authentication listener.

Symptoms

  • Immediate localhost error
  • Port 8080 conflict message
  • Browser may never open
  • HMRC login may open but never return to Navigator

Resolution

Close unnecessary applications.

Restart Navigator and retry the authorisation.

If the issue persists:

Open Command Prompt as Administrator and run:

netstat -ano | findstr :8080

If a process is listening on port 8080, note the PID.

Then run:

tasklist | findstr [PID]

Replace [PID] with the number returned by netstat.

Investigate the identified process and stop it if appropriate.


Cause 2 - Browser Pop-Up Blocking

Description

HMRC authentication frequently launches secondary browser windows.

If these are blocked, Navigator cannot complete the authentication process.

Symptoms

  • HMRC page never appears
  • Authorisation process stalls
  • No token is created

Resolution

Allow pop-ups for HMRC authentication pages.

Retry the authorisation process.


Cause 3 - Browser Forces HTTPS

Description

Navigator requires:

http://localhost:8080

Some browsers, extensions, or security products automatically convert HTTP addresses to HTTPS.

When this occurs, the redirect from HMRC fails.

Symptoms

Address bar changes from:

http://localhost:8080

to:

https://localhost:8080

Resolution

Use a different browser.

Recommended tests:

  • Microsoft Edge
  • Google Chrome Incognito Mode
  • Edge InPrivate Mode

Retry the authorisation process.


Cause 4 - Firewall Restrictions

Description

Windows Firewall or endpoint security products may block localhost communications.

Although the connection never leaves the machine, some security products inspect and block loopback traffic.

Symptoms

  • Browser authentication succeeds
  • Navigator never receives the response
  • Localhost errors appear

Resolution

Temporarily disable security software for testing.

If successful:

  • Re-enable protection immediately
  • Create exclusions for Navigator
  • Allow localhost communication
  • Allow use of port 8080

Cause 5 - Corrupted or Invalid OAuth Token

Description

Navigator stores OAuth tokens after successful authentication.

If:

  • HMRC account details change
  • HMRC credentials change
  • HMRC revokes access
  • Token data becomes invalid

Navigator may fail authentication attempts.

Symptoms

  • Authentication repeatedly fails
  • HMRC returns authorisation errors
  • Existing token exists but cannot be used

HMRC OAuth Token Endpoint Errors

These errors occur during token exchange.

ScenarioHTTP StatusError CodeError Message
Client ID missing400invalid_requestclient_id is required
Client ID invalid401invalid_clientinvalid client id or secret
Client Secret missing400invalid_requestclient_secret is required
Client Secret invalid401invalid_clientinvalid client id or secret
Grant Type missing400invalid_requestgrant_type is required
Grant Type invalid400invalid_requestunsupported grant_type
Invalid scope400invalid_scopescope is invalid
Internal server error500server_errorVarious

What These Mean

These errors occur during communication between Navigator and HMRC's authentication service.

Unexpected errors outside this list often indicate:

  • Network restrictions
  • Proxy issues
  • Firewall interference
  • Blocked POST requests

VAT Submission Error Reference

VRN_INVALID

HTTP Status

400 Bad Request

Meaning

The VAT Registration Number is invalid or missing.

Navigator obtains this value from:

System Values > General > Your Company

Resolution

Verify the VAT Registration Number is entered correctly.

Typical format:

GB123456789

Navigator extracts the numeric portion automatically.


CLIENT_OR_AGENT_NOT_AUTHORISED

HTTP Status

403 Forbidden

Meaning

The HMRC account used for authentication is not authorised for the VAT registration being submitted.

Possible Causes

  • Final non-MTD return still required
  • Incorrect HMRC account used
  • Authorisation not granted
  • Invalid token

Resolution

Contact HMRC first.

Do not delete the token unless HMRC advises doing so.


DUPLICATE_SUBMISSION

HTTP Status

403 Forbidden

Meaning

The VAT period has already been submitted.

Resolution

Verify whether the VAT obligation has already been fulfilled through HMRC.


TAX_PERIOD_NOT_ENDED

HTTP Status

403 Forbidden

Meaning

The VAT period is still open.

Resolution

Wait until the VAT period has ended before submitting.


CODE_IS_INVALID

Example Error

System.Net.WebException:
Error when authenticating by code:
Error Code: BadRequest
Error content:
{"error":"invalid_request","error_description":"code is invalid"}

Meaning

The authorisation code supplied to Navigator is invalid.

Resolution

Repeat the HMRC authorisation process.

Ensure the authorisation code is copied exactly as provided.


Additional Technical Errors

INVALID_DATE_FROM

Meaning

The start date supplied to HMRC is invalid.

Resolution

Verify the selected VAT period.


INVALID_DATE_TO

Meaning

The end date supplied to HMRC is invalid.

Resolution

Verify the selected VAT period.


INVALID_DATE_RANGE

Meaning

HMRC rejected the requested date range.

Resolution

Contact Navigator Support if this occurs.


PERIOD_KEY_INVALID

Meaning

HMRC rejected the selected obligation period.

Resolution

Retry the submission.

If the issue persists, contact Navigator Support.


NOT_FINALISED

HTTP Status

403 Forbidden

Meaning

The VAT return has not been declared final.

Resolution

Confirm the final declaration checkbox has been selected before submission.


INVALID_REQUEST

Meaning

HMRC rejected the request format.

Resolution

Contact Navigator Support.


NOT_FOUND

HTTP Status

404 Not Found

Meaning

HMRC did not return the requested data.

Resolution

Retry later.

The HMRC service may be unavailable.


HMRC Numeric Validation Errors

HMRC performs validation against all VAT figures before accepting a submission.

Possible validation responses include:

Error CodeMeaning
VAT_TOTAL_VALUETotal VAT due does not equal expected calculation
VAT_NET_VALUENet VAT due calculation invalid
INVALID_NUMERIC_VALUENon-numeric value supplied
INVALID_MONETARY_AMOUNTMonetary value outside permitted range
INVALID_MONETARY_AMOUNTToo many decimal places
INVALID_MONETARY_AMOUNTNegative value not permitted

Review the VAT figures being submitted and correct any underlying data issues before retrying.


Recommended Troubleshooting Order

If you receive a localhost, 127.0.0.1, or port 8080 error:

  1. Close Navigator.
  2. Restart the workstation.
  3. Retry the HMRC authorisation.
  4. Allow browser pop-ups.
  5. Test using a different browser.
  6. Confirm the browser is not forcing HTTPS.
  7. Temporarily disable firewall or antivirus software.
  8. Check for applications using port 8080.
  9. Remove HMRC OAuth tokens only if advised.
  10. Retry authentication.
  11. Contact Navigator Support if the issue remains unresolved.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article