SonarSource/sonarqube · error · IllegalArgumentException

Entity of type ' ' is not supported

Error message

Entity of type '%s' is not supported

What it means

Thrown by api/issues/tags when the 'component' parameter resolves to an entity whose qualifier is neither PROJECT nor VIEW/APP. Tag searches support only these entity types; files, directories, and other qualifiers are rejected with IllegalArgumentException (HTTP 400).

Solutions

  1. Use the top-level project key in the component parameter
  2. For file-level tag data, call api/issues/search with component=<file> and facets=tags instead
  3. Check the qualifier with GET api/components/show before calling

Example fix

// before
curl '.../api/issues/tags?component=com.example:app:src/utils'
// after
curl '.../api/issues/search?component=com.example:app:src/utils&facets=tags'
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('use project/view/app key');

Try / catch

try { await get('/api/issues/tags', {component: key}); } catch (e) { if (e.status === 400 && e.message.includes('not supported')) { /* fall back to project-level tags or facets */ } else throw e; }

Prevention

When it happens

Trigger: Calling GET api/issues/tags with component=<file or directory key>; passing component keys of types not handled by the switch statement.

Common situations: Trying to list tags for a single file's issues; reusing scripts that assumed component granularity; keys that resolved to projects in older versions but to sub-components after scanner/structure changes.

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/3889d572994b0440. Report an issue: GitHub.

Appendix: source

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

      .filter(e -> !e.getQualifier().equals(ComponentQualifiers.SUBVIEW));
  }

  private void checkIfAnyComponentsNeedIssueSync(DbSession session, @Nullable String projectKey) {
    if (projectKey != null) {
      issueIndexSyncProgressChecker.checkIfComponentNeedIssueSync(session, projectKey);
    } else {
      issueIndexSyncProgressChecker.checkIfIssueSyncInProgress(session);
    }
  }

  private List<String> searchTags(@Nullable EntityDto entity, @Nullable BranchDto branch, Request request, boolean all, DbSession dbSession) {
    IssueQuery.Builder issueQueryBuilder = IssueQuery.builder()
      .types(ISSUE_TYPE_NAMES);
    if (entity != null) {
      switch (entity.getQualifier()) {
        case ComponentQualifiers.PROJECT -> issueQueryBuilder.projectUuids(Set.of(entity.getUuid()));
        case ComponentQualifiers.VIEW, ComponentQualifiers.APP -> issueQueryBuilder.viewUuids(Set.of(entity.getUuid()));
        default -> throw new IllegalArgumentException(String.format("Entity of type '%s' is not supported", entity.getQualifier()));
      }

      if (branch != null && !branch.isMain()) {
        issueQueryBuilder.branchUuid(branch.getUuid());
        issueQueryBuilder.mainBranch(false);
      } else if (ComponentQualifiers.APP.equals(entity.getQualifier())) {
        dbClient.branchDao().selectMainBranchByProjectUuid(dbSession, entity.getUuid())
          .ifPresent(b -> issueQueryBuilder.branchUuid(b.getUuid()));
      }
    }
    if (all) {
      issueQueryBuilder.mainBranch(null);
    }

    return issueIndex.searchTags(
      issueQueryBuilder.build(),
      request.param(TEXT_QUERY),
      request.mandatoryParamAsInt(PAGE_SIZE));

View on GitHub (pinned to 184c821202)