iflytek/astron-agent · warning
Workflow version not found in database: botId=
Error message
Workflow version not found in database: botId={}, versionName={} What it means
getVersionSysData queries workflow_version by botId and exact version name (LIMIT 1). When no row matches, it logs a warning with both identifiers and returns null; the caller versionData then has no sysData to return. This indicates the requested published version does not exist for that bot.
Solutions
- Verify botId and versionName by listing existing versions (SELECT name FROM workflow_version WHERE bot_id=...) before calling
- Confirm the version was actually published and not deleted or renamed
- Check that the caller is operating in the correct space and the query isn't space-scoped away from the row
- Handle the null return in versionData instead of letting it propagate as NPE downstream
Example fix
// before
WorkflowVersion v = mapper.selectOne(qw.eq(botId).eq(name).last("LIMIT 1"));
return v.getSysData(); // NPE risk
// after
WorkflowVersion v = getVersionSysData(botId, versionName);
if (v == null) { throw new EntityNotFoundException("version " + versionName + " not found for bot " + botId); } Defensive patterns
Strategy: validation
Validate before calling
// verify the version exists before calling versionData
Long count = workflowVersionMapper.selectCount(
new LambdaQueryWrapper<WorkflowVersion>()
.eq(WorkflowVersion::getBotId, botId)
.eq(WorkflowVersion::getName, versionName));
if (count == 0) throw new IllegalArgumentException("Version " + versionName + " not found for bot " + botId); Try / catch
String sysData = service.versionData(botId, versionName);
if (sysData == null) {
throw new ResponseStatusException(NOT_FOUND, "Workflow version " + versionName + " not found");
} Prevention
- Always list a bot's versions before referencing one by name
- Treat version names as immutable once published; re-fetch after any publish/delete
- Scope checks to the correct space to avoid silently missing rows
- Never assume a cached versionName is still valid
When it happens
Trigger: versionData(botId, versionName) is called with a versionName that has no matching row in the workflow_version table (typo, version never published, version deleted, wrong botId, or space mismatch filtering the row out).
Common situations: Client caches an old version name after the version was deleted/re-published; calling with a draft name that was never published; cross-space access where the bot belongs to another space; IDs passed as strings and truncated.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/8ef5b72514d143dc.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/workflow/impl/WorkflowReleaseServiceImpl.java:260
}
/**
* Get version system data from database
*/
private JSONObject getVersionSysData(Integer botId, String versionName) {
try {
log.info("Getting version system data from database: botId={}, versionName={}", botId, versionName);
// Query database for workflow version
LambdaQueryWrapper<WorkflowVersion> queryWrapper = new LambdaQueryWrapper<WorkflowVersion>()
.eq(WorkflowVersion::getBotId, botId.toString())
.eq(WorkflowVersion::getName, versionName)
.last("LIMIT 1");
WorkflowVersion workflowVersion = workflowVersionMapper.selectOne(queryWrapper);
if (workflowVersion == null) {
log.warn("Workflow version not found in database: botId={}, versionName={}", botId, versionName);
return null;
}
String sysData = workflowVersion.getSysData();
if (sysData != null && !sysData.trim().isEmpty()) {
try {
JSONObject versionData = JSON.parseObject(sysData);
return versionData == null || versionData.isEmpty() ? null : versionData;
} catch (Exception e) {
log.error(
"Failed to parse sysData JSON: botId={}, versionName={}, sysDataLength={}",
botId,
versionName,
sysData.length(),
e);
return null;
}
}View on GitHub (pinned to 5e758547a8)