iflytek/astron-agent · warning · BusinessException
WORKFLOW_QUERY_LENGTH_OUTRANGE
WORKFLOW_QUERY_LENGTH_OUTRANGE
Error message
WORKFLOW_QUERY_LENGTH_OUTRANGE
What it means
Thrown by WorkflowService during paginated prompt-template queries when the search term exceeds the maximum allowed length of 30 characters. The service validates search length before applying it to the MyBatis-Plus query wrapper.
Solutions
- Shorten the search term to 30 characters or fewer before calling the API
- Add client-side maxLength=30 on the search input to fail fast
- Trim and validate the search string in the client before sending
- If server behavior change is desired, raise the limit in WorkflowService (product decision)
Example fix
// before
const results = await api.searchPromptTemplates({ search: userInput });
// after
const term = userInput.trim().slice(0, 30);
const results = await api.searchPromptTemplates({ search: term }); Defensive patterns
Strategy: validation
Validate before calling
const term = searchInput.trim();
if (term.length > 30) {
throw new Error("Search term must be 30 characters or fewer");
} Prevention
- Set maxLength=30 on search inputs
- Trim user input before sending
- Document the 30-char limit in the API contract/OpenAPI schema
When it happens
Trigger: Calling the prompt template list/search API with a search parameter whose string length is greater than 30, e.g. pasting a whole sentence or prompt text into the search box.
Common situations: Frontend search box lacking maxLength validation; user pasting long text as a search term; API consumers sending full prompt content instead of a short keyword.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/e68f55d2ff22ea64.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowService.java:5750
return name;
}
// If JSON serialization is needed, setter methods can be added
public void setName(String name) {
this.name = name;
}
}
public PageData<PromptTemplate> listPagePromptTemplate(Integer current, Integer pageSize, String search) {
// 1. Build query conditions
LambdaQueryWrapper<PromptTemplate> wrapper = Wrappers.lambdaQuery(PromptTemplate.class)
.eq(PromptTemplate::getDeleted, false)
.orderByDesc(PromptTemplate::getCreatedTime);
// 2. Handle search
if (search != null) {
if (search.length() > 30) {
throw new BusinessException(ResponseEnum.WORKFLOW_QUERY_LENGTH_OUTRANGE);
}
dealWithSearchPromptTemplate(search, wrapper);
}
// 3. Use MyBatis-Plus pagination query (efficient)
Page<PromptTemplate> page = new Page<>(current, pageSize);
Page<PromptTemplate> result = promptTemplateMapper.selectPage(page, wrapper);
for (PromptTemplate record : result.getRecords()) {
// {"characterSettings": "characterSettings", "thinkStep": "thinkStep", "userQuery": "userQuery"}
JSONObject json = JSON.parseObject(record.getPrompt());
record.setCharacterSettings(json.get("characterSettings").toString());
record.setThinkStep(json.get("thinkStep").toString());
record.setUserQuery(json.get("userQuery").toString());
record.setJsonAdaptationModel(JSON.parseObject(record.getAdaptationModel()));
record.setInputs(extractInputs(record.getPrompt()));
}
View on GitHub (pinned to 5e758547a8)