SonarSource/sonarqube · error · IllegalArgumentException

Component of type '%s' is not supported

Error message

Component of type '%s' is not supported

What it means

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).

Source

Thrown at server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/AuthorsAction.java:131

      return Optional.empty();
    }
    return Optional.of(dbClient.entityDao().selectByKey(dbSession, projectKey)
      .filter(e -> !e.getQualifier().equals(ComponentQualifiers.SUBVIEW))
      .orElseThrow(() -> new NotFoundException("Entity not found: " + projectKey)));
  }

  private List<String> getAuthors(DbSession session, @Nullable EntityDto entity, Request request) {
    IssueQuery.Builder issueQueryBuilder = IssueQuery.builder();
    ofNullable(entity).ifPresent(p -> {
      switch (p.getQualifier()) {
        case ComponentQualifiers.PROJECT -> issueQueryBuilder.projectUuids(Set.of(p.getUuid()));
        case ComponentQualifiers.VIEW -> issueQueryBuilder.viewUuids(Set.of(p.getUuid()));
        case ComponentQualifiers.APP -> {
          BranchDto appMainBranch = dbClient.branchDao().selectMainBranchByProjectUuid(session, entity.getUuid())
            .orElseThrow(() -> new IllegalStateException("Couldn't find main branch for APP " + entity.getUuid()));
          issueQueryBuilder.viewUuids(Set.of(appMainBranch.getUuid()));
        }
        default -> throw new IllegalArgumentException(String.format("Component of type '%s' is not supported", p.getQualifier()));
      }
    });
    return issueIndex.searchAuthors(
      issueQueryBuilder
        .types(ALL_RULE_TYPES_EXCEPT_SECURITY_HOTSPOTS.stream().map(Enum::name).toList())
        .build(),
      request.param(TEXT_QUERY),
      request.mandatoryParamAsInt(PAGE_SIZE));
  }
}

View on GitHub (pinned to 184c821202)

Solutions

  1. Call api/issues/authors with the top-level project key instead of a file/directory key
  2. If you need file-level data, use api/issues/search with component=<file key> and facet on assignees/authors where supported
  3. Verify the component qualifier via GET api/components/show before calling

Example fix

// before
curl '.../api/issues/authors?component=com.example:app:src/Main.java'
// after
curl '.../api/issues/authors?component=com.example:app'
Defensive patterns

Strategy: validation

Validate before calling

const comp = await get('/api/components/show', {component: key});
if (!['TRK','VW','APP'].includes(comp.component.qualifier)) throw new Error('component must be project, view or app');

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09). Data as JSON: /api/errors/f043e02257311beb. Report an issue: GitHub.