apolloconfig/apollo · error · BadRequestException

Current user not found

Error message

Current user not found

What it means

Thrown by resolveOperator when the request's auth type is USER or USER_TOKEN but no logged-in user can be resolved from the identity context (null user or blank userId).

Source

Thrown at apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/v1/controller/ReleaseController.java:260

  }

  private void checkEmergencyPublishAllowedForUser(String env, boolean emergencyPublish) {
    String authType = UserIdentityContextHolder.getAuthType();
    if (emergencyPublish
        && (UserIdentityConstants.USER.equals(authType)
            || UserIdentityConstants.USER_TOKEN.equals(authType))
        && !portalConfig.isEmergencyPublishAllowed(Env.valueOf(env))) {
      throw new BadRequestException("Env: %s is not supported emergency publish now", env);
    }
  }

  private String resolveOperator(String queryOperator, String payloadOperator) {
    String authType = UserIdentityContextHolder.getAuthType();
    if (UserIdentityConstants.USER.equals(authType)
        || UserIdentityConstants.USER_TOKEN.equals(authType)) {
      UserInfo loginUser = userInfoHolder.getUser();
      if (loginUser == null || StringUtils.isBlank(loginUser.getUserId())) {
        throw new BadRequestException("Current user not found");
      }
      return loginUser.getUserId();
    }

    if (UserIdentityConstants.CONSUMER.equals(authType)) {
      String operator = StringUtils.isBlank(queryOperator) ? payloadOperator : queryOperator;
      RequestPrecondition.checkArguments(!StringUtils.isContainEmpty(operator),
          "operator should not be null or empty");
      if (userService.findByUserId(operator) == null) {
        throw BadRequestException.userNotExists(operator);
      }
      return operator;
    }

    throw new BadRequestException("Unsupported auth type: %s", authType);
  }

  private boolean shouldHideConfigToPortalUser(String appId, String env, String clusterName,

View on GitHub (pinned to d95fc18d11)

Solutions

  1. Log in to the Apollo portal before calling this endpoint so a user session exists.
  2. If using a consumer token, pass a non-empty operator parameter (query or payload) identifying an existing Apollo user.
  3. If using a user token, ensure the token is valid and associated with an existing user.

When it happens

Trigger: Thrown when the operator of the request cannot be resolved: neither a valid consumer token nor a logged-in portal user is present on the release request.

Common situations: Missing Authorization token header; expired or revoked consumer token; unauthenticated portal session.


AI-assisted analysis of apolloconfig/apollo@d95fc18d11 (2026-08-14). Data as JSON: /api/errors/1f522d1c6fe73897. Report an issue: GitHub.