iflytek/astron-agent · error · BusinessException
APPID_CANNOT_EMPTY
APPID_CANNOT_EMPTY
Error message
APPID_CANNOT_EMPTY
What it means
APPID_CANNOT_EMPTY is thrown by the private replaceAppIdAfterAuthorization method when the appId argument passed for re-binding an authorized workflow's app id is null or blank. The method rewrites the old appId embedded in the workflow's data/publishedData JSON and the entity's appId column, and refuses to proceed without a target appId.
Solutions
- Ensure the caller supplies a non-blank appId before invoking the authorization/replace endpoint.
- Verify the authorization step completed and actually produced an appId; re-run authorization if not.
- Add request-level @NotBlank validation on the appId parameter so the failure surfaces as a 400 with a clear message.
- Check environment/config for missing app credentials if appId is expected to come from configuration.
Example fix
// before
workflowService.replaceAppIdAfterAuthorization("", workflow); // throws APPID_CANNOT_EMPTY
// after
if (StringUtils.isBlank(appId)) {
throw new IllegalArgumentException("appId is required to bind the workflow");
}
workflowService.replaceAppIdAfterAuthorization(appId, workflow); Defensive patterns
Strategy: validation
Validate before calling
if (appId == null || appId.isBlank()) {
throw new IllegalArgumentException("appId must be provided to bind the workflow");
} Try / catch
try {
workflowService.authorizeAndReplaceAppId(appId, flowId);
} catch (BusinessException e) {
if ("APPID_CANNOT_EMPTY".equals(e.getCode())) {
return ApiResult.badRequest("appId is required");
}
throw e;
} Prevention
- Annotate appId request params with @NotBlank for 400-level validation.
- Verify authorization callbacks always deliver an appId before calling replace.
- Provision app credentials per environment and fail config load if missing.
- Log the authorization response keys to catch platforms that omit appId.
When it happens
Trigger: Calling the authorization flow (the public method that delegates to replaceAppIdAfterAuthorization) with an empty/blank appId — e.g. the upstream authorization response contained no app id, a config field was not filled, or the caller passed an uninitialized variable.
Common situations: OAuth/authorization callbacks where the platform did not return an appId; forms where the appId field was left blank; environment misconfiguration where app credentials were never provisioned; older clients omitting the appId request parameter.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- PROMPT_GROUP_PROMPT_CANNOT_EMPTY
- PARAM_ERROR
- User UID cannot be null
- DUPLICATE_BOT_NAME
- UPDATE_BOT_FAILED
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/693bde37cd42fb8c.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowService.java:5057
}
config.setCustomize(customize);
config.setCreateTime(new Date());
config.setUpdateTime(new Date());
mcpToolConfigMapper.updateById(config);
}
}
public Object replaceAppId(String appId, String flowId) {
log.info("replace appid for flowId={}", flowId);
Workflow workflow = requireOwnedWorkflow(flowId);
replaceAppIdAfterAuthorization(appId, workflow);
return ApiResult.success(true);
}
private void replaceAppIdAfterAuthorization(String appId, Workflow workflow) {
if (StringUtils.isBlank(appId)) {
throw new BusinessException(ResponseEnum.APPID_CANNOT_EMPTY);
}
if (workflow == null
|| workflow.getId() == null
|| Boolean.TRUE.equals(workflow.getDeleted())) {
throw new BusinessException(ResponseEnum.WORKFLOW_NOT_EXIST);
}
String oldAppId = workflow.getAppId();
if (StringUtils.isNotBlank(oldAppId)) {
if (StringUtils.isNotBlank(workflow.getData())) {
workflow.setData(workflow.getData().replace(oldAppId, appId));
}
if (StringUtils.isNotBlank(workflow.getPublishedData())) {
workflow.setPublishedData(workflow.getPublishedData().replace(oldAppId, appId));
}
}
workflow.setAppId(appId);
workflow.setUpdateTime(new Date());
if (workflowMapper.updateById(workflow) != 1) {View on GitHub (pinned to 5e758547a8)