Code Analysis Error: Cannot read file tsconfig-web.json

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any
    SonarCube Cloud 3.1.1
    .Net Scanner Version 9.2.1.110358
    Self Hosted Agent

Hi Team, we have several errors in the result of the code analysis, any idea how to fix this?

##[error]ERROR: Error: Cannot read file ‘*.SharePoint.GulpProjects/*****.SharePoint.PortalLinkCustomizer/node_modules/@ microsoft/rush-stack-compiler-4.5/includes/tsconfig-web.json’.

##[error]ERROR: Failed to create program: Cannot read file ‘’*.SharePoint.GulpProjects/*****.SharePoint.SearchWebPart/node_modules/@ microsoft/rush-stack-compiler-4.5/includes/tsconfig-web.json’.

Hi,

Welcome to the community!

You’ve posted in the SonarQube self-hosted category, but noted that you’re using the SonarQube Cloud extension for Azure DevOps. Are you self-hosted or in the cloud?

There’s honestly not enough to go on here. Can you provide at least the full stacktrace of these errors?

 
Ann

Sure, please find the stacktrace below:


##[error]ERROR: Error: Cannot read file 'D:/B/A2/1/s/WebApplication/xx.SharePoint.GulpProjects/xx.SharePoint.PortalLinkCustomizer/node_modules/@microsoft/rush-stack-compiler-4.5/includes/tsconfig-web.json'.
ERROR: Error: Cannot read file 'D:/B/A2/1/s/WebApplication/xx.SharePoint.GulpProjects/xx.SharePoint.PortalLinkCustomizer/node_modules/@microsoft/rush-stack-compiler-4.5/includes/tsconfig-web.json'.
##[error]ERROR:     at _Je (D:\B\A2\1\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:47046)
ERROR:     at rPf (D:\B\A2\1\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:47226)
ERROR:     at _Bt (D:\B\A2\1\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:47739)
ERROR:     at Kqt (D:\B\A2\1\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:74094)
ERROR:     at MessagePort.<anonymous> (D:\B\A2\1\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:78271)
ERROR:     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:816:20)
ERROR:     at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28)
ERROR:     at _Je (D:\B\A2\1\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:47046)
ERROR:     at rPf (D:\B\A2\1\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:47226)
ERROR:     at _Bt (D:\B\A2\1\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:47739)
ERROR:     at Kqt (D:\B\A2\1\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:74094)
ERROR:     at MessagePort.<anonymous> (D:\B\A2\1\.sonarqube\out\.sonar\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:78271)
ERROR:     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:816:20)
ERROR:     at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28)

Hi,

Hmm… that didn’t get me as much as I hoped. I expected there to be a couple of Caused by lines to reveal the underlying problem.

At this point it’s debugging the hard way:

  • does the file actually exist?
  • what are the file’s properties?
  • is there some other process running on the build agent (e.g. a virus scan) that would interfere with file access?

 
HTH,
Ann

Hello Ann, if you want i can send you the complete log of the run? Please share an email address to send to if such is possible.

Hi,

You can post it here. Feel free to redact as necessary.

 
Ann

The file does exist in this folder:

xxx\WebApplication\xx.SharePoint.GulpProjects\xx.SharePoint.PortalLinkCustomizer\tsconfig.json

The content of the file shows below

{
  "extends": "./node_modules/@microsoft/rush-stack-compiler-4.5/includes/tsconfig-web.json",
  "compilerOptions": {
    "target": "es5",
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "jsx": "react",
    "declaration": true,
    "sourceMap": true,
    "experimentalDecorators": true,
    "skipLibCheck": true,
    "outDir": "lib",
    "inlineSources": false,
    "strictNullChecks": false,
    "noImplicitAny": true,
    "noUnusedLocals": false,

    "typeRoots": [
      "./node_modules/@types",
      "./node_modules/@microsoft"
    ],
    "types": [
      "webpack-env"
    ],
    "lib": [
      "es5",
      "dom",
      "es2015.collection",
      "es2015.promise"
    ]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx"
  ]
}

Hi,

What about the other questions I posed?

 
Ann

Hi Ann,

For the file properties, it a readable and editable file:
A virus scanner is present on the server

Get-ItemProperty 'xxx\WebApplication\xx.SharePoint.GulpProjects\xx.SharePoint.PortalLinkCustomizer\tsconfig.json' | Format-List

    Directory: xxx\WebApplication\xx.SharePoint.GulpProjects\xx.SharePoint.PortalLinkCustomizer\

Name           : tsconfig.json
Length         : 837
CreationTime   : 18/03/2025 14:18:19
LastWriteTime  : 18/03/2025 14:18:19
LastAccessTime : 18/03/2025 14:29:36
Mode           : -a---
LinkType       :
Target         :
VersionInfo    : File:             xxx\WebApplication\xx.SharePoint.GulpProjects\xx.SharePoint.PortalLinkCustomizer\tsconfig.json
                 InternalName:
                 OriginalFilename:
                 FileVersion:
                 FileDescription:
                 Product:
                 ProductVersion:
                 Debug:            False
                 Patched:          False
                 PreRelease:       False
                 PrivateBuild:     False
                 SpecialBuild:     False
                 Language:

I have configured the Sonar scanner with sonar.log.level=Trace to get more details for you tomorrow.

Hi,

Can you make those logs DEBUG level instead of trace, please? :sweat_smile:

And it’s worth disabling the virus scan.

 
HTH,
Ann

1 Like

Hi Ann,

Thanks for the quick reply, I have set the log level to Debug.
The virusscanner cannot be disabled due to company policies.

Hi,

I’m not sure I can be much help while this is the case. We explicitly recommend against running an antivirus on the CI agent. Per the docs:

We do not recommend running an antivirus scanner on the machine where a SonarQube Server analysis runs, it could result in unpredictable behavior.

 
Ann

Hi Ann,

I have ran the scan on the same codebase with Microsoft hosted agent, which has no virusscanner. It also gives the same errors:

15:39:28.150 INFO  SonarScanner CLI 7.0.2.4839
15:39:28.154 INFO  Java 21.0.6 Eclipse Adoptium (64-bit)
15:39:28.173 INFO  Windows Server 2025 10.0 amd64
2025-03-18T15:41:05.8363268Z 15:41:05.832 INFO  Creating TypeScript program
2025-03-18T15:41:05.8363741Z 15:41:05.832 INFO  TypeScript configuration file D:\a\52\s\WebApplication\xx.SharePoint.GulpProjects\xx.SharePoint.PortalLinkCustomizer\tsconfig.json
2025-03-18T15:41:05.8522099Z ##[error]15:41:05.846 ERROR Error: Cannot read file 'D:/a/52/s/WebApplication/xx.SharePoint.GulpProjects/xx.SharePoint.PortalLinkCustomizer/node_modules/@microsoft/rush-stack-compiler-4.5/includes/tsconfig-web.json'.
15:41:05.847 ERROR     at _Je (D:\a\52\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:47046)
15:41:05.847 ERROR     at rPf (D:\a\52\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:47226)
15:41:05.847 ERROR     at _Bt (D:\a\52\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:47739)
15:41:05.847 ERROR     at Kqt (D:\a\52\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:74094)
15:41:05.847 ERROR     at MessagePort.<anonymous> (D:\a\52\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:78271)
15:41:05.847 ERROR     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:816:20)
15:41:05.847 ERROR     at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28)
2025-03-18T15:41:05.8525476Z 15:41:05.846 ERROR Error: Cannot read file 'D:/a/52/s/WebApplication/xx.SharePoint.GulpProjects/xx.SharePoint.PortalLinkCustomizer/node_modules/@microsoft/rush-stack-compiler-4.5/includes/tsconfig-web.json'.
2025-03-18T15:41:05.8526150Z 15:41:05.847 ERROR     at _Je (D:\a\52\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:47046)
2025-03-18T15:41:05.8526697Z 15:41:05.847 ERROR     at rPf (D:\a\52\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:47226)
2025-03-18T15:41:05.8527548Z 15:41:05.847 ERROR     at _Bt (D:\a\52\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:47739)
2025-03-18T15:41:05.8528070Z 15:41:05.847 ERROR     at Kqt (D:\a\52\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:74094)
2025-03-18T15:41:05.8529524Z 15:41:05.847 ERROR     at MessagePort.<anonymous> (D:\a\52\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2115:78271)
2025-03-18T15:41:05.8530588Z 15:41:05.847 ERROR     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:816:20)
2025-03-18T15:41:05.8531957Z 15:41:05.847 ERROR     at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28)
2025-03-18T15:41:05.8533386Z ##[error]15:41:05.849 ERROR Failed to create program: Cannot read file 'D:/a/52/s/WebApplication/xx.SharePoint.GulpProjects/xx.SharePoint.PortalLinkCustomizer/node_modules/@microsoft/rush-stack-compiler-4.5/includes/tsconfig-web.json'.
2025-03-18T15:41:05.8534658Z 15:41:05.849 ERROR Failed to create program: Cannot read file 'D:/a/52/s/WebApplication/xx.SharePoint.GulpProjects/xx.SharePoint.PortalLinkCustomizer/node_modules/@microsoft/rush-stack-compiler-4.5/includes/tsconfig-web.json'.

Hi,

And is the rest of analysis running from D: or another drive?

 
Ann

Yes, all analysis is running from the same drive.

Hi,

Then yeah, I think we need that debug log.

 
Thx,
Ann

Hello Ann,

The debuglog did not give more information about the issue.

We have decided to exclude the tsconfig.json file from scanning and this resolved the issue.

Thanks for the quick replies