apolloconfig/apollo · warning · BadRequestException
Env: %s is not supported emergency publish now
Error message
Env: %s is not supported emergency publish now
What it means
BadRequestException (HTTP 400) from ReleaseController.createRelease (normal release). Identical guard to the merge path: model.isEmergencyPublish() true combined with portalConfig.isEmergencyPublishAllowed(env) false for that env is rejected, with env filled into the %s placeholder.
Source
Thrown at apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ReleaseController.java:89
this.unifiedPermissionValidator = unifiedPermissionValidator;
this.userInfoHolder = userInfoHolder;
}
@PreAuthorize(
value = "@unifiedPermissionValidator.hasReleaseNamespacePermission(#appId, #env, #clusterName, #namespaceName)")
@PostMapping(
value = "/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/releases")
public ReleaseDTO createRelease(@PathVariable String appId, @PathVariable String env,
@PathVariable String clusterName, @PathVariable String namespaceName,
@RequestBody NamespaceReleaseModel model) {
model.setAppId(appId);
model.setEnv(env);
model.setClusterName(clusterName);
model.setNamespaceName(namespaceName);
model.setReleasedBy(userInfoHolder.getUser().getUserId());
if (model.isEmergencyPublish() && !portalConfig.isEmergencyPublishAllowed(Env.valueOf(env))) {
throw new BadRequestException("Env: %s is not supported emergency publish now", env);
}
ReleaseDTO createdRelease = releaseService.publish(model);
ConfigPublishEvent event = ConfigPublishEvent.instance();
event.withAppId(appId).withCluster(clusterName).withNamespace(namespaceName)
.withReleaseId(createdRelease.getId()).setNormalPublishEvent(true).setEnv(Env.valueOf(env));
publisher.publishEvent(event);
return createdRelease;
}
@PreAuthorize(
value = "@unifiedPermissionValidator.hasReleaseNamespacePermission(#appId, #env, #clusterName, #namespaceName)")
@PostMapping(
value = "/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/releases")
public ReleaseDTO createGrayRelease(@PathVariable String appId, @PathVariable String env,View on GitHub (pinned to d95fc18d11)
Solutions
- Publish normally (emergencyPublish=false) for envs not allowlisted.
- Add the env to portal emergency-publish supportedEnvs if emergency publish is intended there.
- Branch the flag by env in the client (see validationCode).
- Validate env allowlist state before each release job.
Example fix
// before model.setEmergencyPublish(true); // PROD -> 400 // after model.setEmergencyPublish(allowedEnvs.contains(env.toUpperCase(Locale.ROOT)));
Defensive patterns
Strategy: validation
Validate before calling
// Gate emergencyPublish by env for normal releases.
boolean emergency = requestedEmergency
&& emergencySupportedEnvs.contains(env.toUpperCase(Locale.ROOT));
model.setEmergencyPublish(emergency); Prevention
- Maintain the portal's emergency-publish supportedEnvs list in your automation config.
- Default emergencyPublish off; enable per-env only when allowed.
- On 400, fall back to a normal release.
- Validate env spelling/case against the allowlist.
When it happens
Trigger: POST /apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/releases with emergencyPublish=true for an env absent from the portal emergency-publish allowlist.
Common situations: Automation that forces emergencyPublish on every release; PROD excluded by policy; env renamed/added without updating supportedEnvs.
Related errors
- release is not active
- Can't rollback namespace(appId=%s, clusterName=%s, namespace
- current release equal to target release
- release ids can not be empty
- Env: %s is not supported emergency publish now
AI-assisted analysis of apolloconfig/apollo@d95fc18d11 (2026-08-14).
Data as JSON: /api/errors/fb74da9fa70ef8a7.
Report an issue: GitHub.