# SonarQube CLI Question - File indexing errors

**URL:** <https://community.sonarsource.com/t/sonarqube-cli-question-file-indexing-errors/109069>\
**Category:** SonarQube Server / Community Build\
**Tags:** scanner, coverage\
**Created:** [February 13, 2024, 4:00am UTC](https://community.sonarsource.com/t/sonarqube-cli-question-file-indexing-errors/109069 "2024-02-13T04:00:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![d0xyl](https://avatars.discourse-cdn.com/v4/letter/d/ea666f/32.png) [@d0xyl](https://community.sonarsource.com/u/d0xyl)\
**Post date:** [February 13, 2024, 4:00am UTC](https://community.sonarsource.com/t/sonarqube-cli-question-file-indexing-errors/109069/1 "2024-02-13T04:00:32Z")

</div>

Must-share information (formatted with [Markdown](https://commonmark.org/help/)):

- Using the latest dotnet-sonarscanner version
- dotnet-sonarscanner being used in a Dockerfile
- Trying to achieve a simple code scan

I have the following directory structure in my C# project:

```auto
.
└── ProjectFolder/
    ├── Dockerfile
    ├── Solution.sln
    ├── Source/
    │ └── ...
    └── Tests/
        └── ...

```

In my `Dockerfile`, I copy over this exact structure:

```auto
WORKDIR /ProjectFolder
RUN mkdir -p Source
RUN mkdir -p Tests
COPY --from=build-env /ProjectFolder/Solution.sln Solution.sln
COPY --from=build-env /ProjectFolder/Source ./Source
COPY --from=build-env /ProjectFolder/Tests ./Tests

```

and then I run the following `dotnet-sonarscanner` command from the base directory:

```auto
RUN /root/.dotnet/tools/dotnet-sonarscanner begin \
    /k:"ProjectFolder" \
    /d:sonar.login="xxxxxxxxxxxxx" \
    /d:sonar.host.url="yyyyyyyy" \
    /d:sonar.cs.opencover.reportsPaths=coverage.xml \
    /d:sonar.exclusions= **/bin/** /*, **/obj/** /* \
    /d:sonar.sources=Source \
    /d:sonar.tests=Tests

```

And I get this error (with the accompany indexing logs):

```auto
37.85 INFO: Indexing files...
37.85 INFO: Project configuration:
37.85 INFO: Excluded sources: **/bin/** /*, **/obj/** /*
37.85 INFO: Indexing files of module 'Tests'
37.85 INFO: Base dir: /ProjectFolder/Tests
37.85 INFO: Test paths: Configuration/BasicAuthOptionsTests.cs, Configuration/HealthOpt...
37.85 INFO: Excluded sources: **/bin/** /*, **/obj/** /*
37.91 INFO: Indexing files of module 'Source'
37.91 INFO: Base dir: /ProjectFolder/Source
37.91 INFO: Source paths: Configuration/BasicAuthOptions.cs, Configuration/HealthOption...
37.91 INFO: Excluded sources: **/bin/** /*, **/obj/** /*
37.96 INFO: Indexing files of module 'Source'
37.96 INFO: Base dir: /ProjectFolder
37.96 INFO: Source paths: Source
37.96 INFO: Test paths: Tests
37.96 INFO: Excluded sources: **/bin/** /*, **/obj/** /*
...
File Source/Services/XXXXX.cs can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files

```

I see that the module `Source` is being indexed twice. How can I prevent this? What am I doing wrong here? I’ve read most of [Narrowing the focus with an analysis scope](https://docs.sonarsource.com/sonarqube/latest/project-administration/analysis-scope/) but cannot figure it out…

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [February 14, 2024, 1:22pm UTC](https://community.sonarsource.com/t/sonarqube-cli-question-file-indexing-errors/109069/2 "2024-02-14T13:22:35Z")

</div>

Hi,

Welcome to the community!

TBH, I’m a bit confused about the file structure after you’ve done your copying. But what I really don’t understand is why you feel the need to do the copying in the first place. Why not just `cd` into `ProjectFolder` and run the analysis there?

But anyway…

Part of what happens during the `begin` and build parts of the process is identifying your source and test files. I’m guessing that your explicit specification of `sonar.sources` and `sonar.tests` is causing the double indexing - once for your specification and once for the ‘found’ files.

&nbsp;  
HTH,  
Ann
