{"record":{"id":"f043e02257311beb","repo":"SonarSource/sonarqube","slug":"component-of-type-s-is-not-supported","errorCode":null,"errorMessage":"Component of type '%s' is not supported","messagePattern":"Component of type '(.+?)' is not supported","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/AuthorsAction.java","lineNumber":131,"sourceCode":"      return Optional.empty();\n    }\n    return Optional.of(dbClient.entityDao().selectByKey(dbSession, projectKey)\n      .filter(e -> !e.getQualifier().equals(ComponentQualifiers.SUBVIEW))\n      .orElseThrow(() -> new NotFoundException(\"Entity not found: \" + projectKey)));\n  }\n\n  private List<String> getAuthors(DbSession session, @Nullable EntityDto entity, Request request) {\n    IssueQuery.Builder issueQueryBuilder = IssueQuery.builder();\n    ofNullable(entity).ifPresent(p -> {\n      switch (p.getQualifier()) {\n        case ComponentQualifiers.PROJECT -> issueQueryBuilder.projectUuids(Set.of(p.getUuid()));\n        case ComponentQualifiers.VIEW -> issueQueryBuilder.viewUuids(Set.of(p.getUuid()));\n        case ComponentQualifiers.APP -> {\n          BranchDto appMainBranch = dbClient.branchDao().selectMainBranchByProjectUuid(session, entity.getUuid())\n            .orElseThrow(() -> new IllegalStateException(\"Couldn't find main branch for APP \" + entity.getUuid()));\n          issueQueryBuilder.viewUuids(Set.of(appMainBranch.getUuid()));\n        }\n        default -> throw new IllegalArgumentException(String.format(\"Component of type '%s' is not supported\", p.getQualifier()));\n      }\n    });\n    return issueIndex.searchAuthors(\n      issueQueryBuilder\n        .types(ALL_RULE_TYPES_EXCEPT_SECURITY_HOTSPOTS.stream().map(Enum::name).toList())\n        .build(),\n      request.param(TEXT_QUERY),\n      request.mandatoryParamAsInt(PAGE_SIZE));\n  }\n}\n","sourceCodeStart":113,"sourceCodeEnd":142,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/AuthorsAction.java#L113-L142","documentation":"Thrown by api/issues/authors when the requested component qualifier is not PROJECT, VIEW, or APP. Author-facet searches only work on those entity types; directories, files, modules, and other qualifiers are rejected with IllegalArgumentException (HTTP 400).","triggerScenarios":"Calling GET api/issues/authors with component=<key> of a file or directory; passing a portfolio sub-view or other qualifier types not handled by the switch.","commonSituations":"Attempting to narrow author facet to a single file's issues; scripts written for projects reused against component keys; components whose qualifier changed after a scanner upgrade (module removal).","solutions":["Call api/issues/authors with the top-level project key instead of a file/directory key","If you need file-level data, use api/issues/search with component=<file key> and facet on assignees/authors where supported","Verify the component qualifier via GET api/components/show before calling"],"exampleFix":"// before\ncurl '.../api/issues/authors?component=com.example:app:src/Main.java'\n// after\ncurl '.../api/issues/authors?component=com.example:app'","handlingStrategy":"validation","validationCode":"const comp = await get('/api/components/show', {component: key});\nif (!['TRK','VW','APP'].includes(comp.component.qualifier)) throw new Error('component must be project, view or app');","typeGuard":null,"tryCatchPattern":"try { await get('/api/issues/authors', {component: key}); } catch (e) { if (e.status === 400 && e.message.includes('not supported')) { /* fall back to project-level query */ } else throw e; }","preventionTips":["Verify qualifier before entity-scoped issue endpoints","Scope to top-level entities only","Use api/issues/search with facets for finer granularity"],"tags":["sonarqube","issues","webapi","unsupported-component"],"backgroundTag":"unsupported-operation","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"}