apolloconfig/apollo · warning · BadRequestException
App's owner not exists. owner = %s
Error message
App's owner not exists. owner = %s
What it means
Thrown by the AppService update path when userService.findByUserId(ownerName) returns null while editing an app. BadRequestException → HTTP 400. The %s is substituted with the offending ownerName via Strings.lenientFormat. Same ownership-validity guard as create, applied on update.
Source
Thrown at apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppService.java:231
@Transactional
@ApolloAuditLog(type = OpType.UPDATE, name = "App.update")
public App updateAppInLocal(App app, String operator) {
validateOperator(operator);
String appId = app.getAppId();
App managedApp = appRepository.findByAppId(appId);
if (managedApp == null) {
throw BadRequestException.appNotExists(appId);
}
managedApp.setName(app.getName());
managedApp.setOrgId(app.getOrgId());
managedApp.setOrgName(app.getOrgName());
String ownerName = app.getOwnerName();
UserInfo owner = userService.findByUserId(ownerName);
if (owner == null) {
throw new BadRequestException("App's owner not exists. owner = %s", ownerName);
}
managedApp.setOwnerName(owner.getUserId());
managedApp.setOwnerEmail(owner.getEmail());
managedApp.setDataChangeLastModifiedBy(operator);
return appRepository.save(managedApp);
}
public EnvClusterInfo createEnvNavNode(Env env, String appId) {
EnvClusterInfo node = new EnvClusterInfo(env);
node.setClusters(clusterService.findClusters(env, appId));
return node;
}
@Transactional
@ApolloAuditLog(type = OpType.DELETE, name = "App.delete")
public App deleteAppInLocal(String appId, String operator) {View on GitHub (pinned to d95fc18d11)
Solutions
- Verify the new ownerName resolves via userService.findByUserId before submitting the update.
- Provision the new owner in the user store first.
- Keep ownerName aligned with the canonical directory userId.
Example fix
// before
managedApp.setOwnerName(newOwner);
appService.updateApp(managedApp, operator);
// after
if (userService.findByUserId(newOwner) == null) {
throw new IllegalArgumentException("new owner " + newOwner + " does not exist");
}
managedApp.setOwnerName(newOwner);
appService.updateApp(managedApp, operator); Defensive patterns
Strategy: validation
Validate before calling
if (userService.findByUserId(ownerName) == null) {
return ResponseEntity.badRequest().body("new owner does not exist: " + ownerName);
} Type guard
boolean isKnownOwner(String ownerName, UserService svc) { return svc.findByUserId(ownerName) != null; } Prevention
- Validate the new owner before reassigning app ownership.
- Use the exact canonical directory userId.
When it happens
Trigger: Updating an app (PUT) and changing ownerName to a userId that does not exist in the user store.
Common situations: Reassigning ownership to a mistyped or not-yet-provisioned user; owner left the org and was removed from the directory; cross-system userId mismatch.
Related errors
- Application's owner not exist.
- operator should not be null or empty
- userIds should not be null or empty
- operator should not be null or empty
- ConsumerApp not exist
AI-assisted analysis of apolloconfig/apollo@d95fc18d11 (2026-08-14).
Data as JSON: /api/errors/0d2faa52dfdeb207.
Report an issue: GitHub.