{"record":{"id":"050b280e1314bd9a","repo":"SonarSource/sonarqube","slug":"report-contains-a-file-with-language-s-but-no-m","errorCode":null,"errorMessage":"Report contains a file with language '%s' but no matching quality profile","messagePattern":"Report contains a file with language '(.+?)' but no matching quality profile","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/ComputeQProfileMeasureStep.java","lineNumber":88,"sourceCode":"    public QProfileAggregationComponentVisitor(Metric qProfilesMetric) {\n      super(CrawlerDepthLimit.FILE, POST_ORDER, new SimpleStackElementFactory<QProfiles>() {\n        @Override\n        public QProfiles createForAny(Component component) {\n          return new QProfiles();\n        }\n      });\n      this.qProfilesMetric = qProfilesMetric;\n    }\n\n    @Override\n    public void visitFile(Component file, Path<QProfiles> path) {\n      String languageKey = file.getFileAttributes().getLanguageKey();\n      if (languageKey == null) {\n        // No qprofile for unknown languages\n        return;\n      }\n      if (!analysisMetadataHolder.getQProfilesByLanguage().containsKey(languageKey)) {\n        throw new IllegalStateException(\"Report contains a file with language '\" + languageKey + \"' but no matching quality profile\");\n      }\n      path.parent().add(analysisMetadataHolder.getQProfilesByLanguage().get(languageKey));\n    }\n\n    @Override\n    public void visitDirectory(Component directory, Path<QProfiles> path) {\n      QProfiles qProfiles = path.current();\n      path.parent().add(qProfiles);\n    }\n\n    @Override\n    public void visitProject(Component project, Path<QProfiles> path) {\n      addMeasure(project, path.current());\n    }\n\n    private void addMeasure(Component component, QProfiles qProfiles) {\n      if (!qProfiles.profilesByKey.isEmpty()) {\n        measureRepository.add(component, qProfilesMetric, qProfiles.createMeasure());","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/ComputeQProfileMeasureStep.java#L70-L106","documentation":"ComputeQProfileMeasureStep's visitor, for each file component, reads the file's language key from the report and looks up the Quality Profile registered for that language in analysisMetadataHolder.getQProfilesByLanguage(). If the language has no matching quality profile loaded for the analysis, it throws IllegalStateException 'Report contains a file with language X but no matching quality profile'. Languages with a null language key are skipped (no qprofile for unknown languages), so this only fires for a known-but-unprofiled language.","triggerScenarios":"The analyzer report contains files whose languageKey (e.g. 'java', 'py') has no quality profile registered in the analysis metadata — typically because no Quality Profile for that language is set as default, or the plugin providing the language/rules was uninstalled/disabled on the server while old reports or sensors still tag files with that language.","commonSituations":"Installing a language plugin, analyzing, then disabling the plugin or its profile; a project using a language whose profile was deleted; profiles exist but none is set as default for the language in this SonarQube instance.","solutions":["Set a default Quality Profile for the language: Administration > Quality Profiles > select the language profile > 'Set as Default' (or POST api/qualityprofiles/set_default)","Re-enable/install the language plugin that provides rules for the language in the report","If the files should not have that language, fix the analyzer configuration (e.g. sonar.sources/sonar.inclusions or file suffixes) so those files are excluded or correctly typed"],"exampleFix":"// before: language 'go' in report, no default Go profile\n$ sonar-scanner -Dsonar.sources=src  // go files fail CE step\n// after: set a default profile via API\ncurl -u admin:token -X POST 'https://sonar.example.com/api/qualityprofiles/set_default?language=go&qualityProfile=Sonar+way'\n// or exclude the files\nsonar.exclusions=src/**/*.go","handlingStrategy":"validation","validationCode":"// before analysis: ensure every language present in sources has a default profile\nfor (String lang : languagesInSources(projectDir)) {\n  boolean hasDefault = adminApi.qualityProfiles().list().stream()\n      .anyMatch(p -> p.language().equals(lang) && p.isDefault());\n  if (!hasDefault) throw new IllegalStateException(\"No default quality profile for language: \" + lang);\n}","typeGuard":"static boolean hasProfileFor(String languageKey, Map<String, QProfile> profilesByLanguage) {\n  return languageKey != null && profilesByLanguage.containsKey(languageKey);\n}","tryCatchPattern":"try {\n  computeEngine.waitForAnalysis(project);\n} catch (IllegalStateException e) {\n  if (e.getMessage().contains(\"but no matching quality profile\")) {\n    String lang = extractLanguage(e.getMessage());\n    adminApi.qualityProfiles().setDefault(lang, \"Sonar way\"); // or re-enable plugin / fix sonar.sources\n  } else throw e;\n}","preventionTips":["Set a default Quality Profile for every language you analyze","Keep language plugins installed and enabled for all languages in sonar.sources","After deleting a profile, immediately set another as default for that language","Align sonar.sources/inclusions with the languages actually supported by the server"],"tags":["quality-profile","compute-engine","language","report"],"backgroundTag":"entity-not-found","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}