elunez/eladmin · error · BadRequestException
应用信息不存在:{appName}
Error message
应用信息不存在:{appName} What it means
DeployServiceImpl.serverReduction (rollback) loads the Deploy for resources.getDeployId(); if that Deploy has no App it sends '应用信息不存在:<appName>' over WebSocket and throws BadRequestException with the same text. Rollback needs the App's backupPath/deployPath to locate the timestamped backup on the target server, so a missing App aborts the operation.
Source
Thrown at eladmin-system/src/main/java/me/zhengjie/modules/maint/service/impl/DeployServiceImpl.java:351
} else {
sb.append("<br>关闭成功!");
sendMsg(sb.toString(), MsgType.INFO);
}
log.info(sb.toString());
executeShellUtil.close();
}
return "执行完毕";
}
@Override
public String serverReduction(DeployHistory resources) {
Long deployId = resources.getDeployId();
Deploy deployInfo = deployRepository.findById(deployId).orElseGet(Deploy::new);
String deployDate = DateUtil.format(resources.getDeployDate(), DatePattern.PURE_DATETIME_PATTERN);
App app = deployInfo.getApp();
if (app == null) {
sendMsg("应用信息不存在:" + resources.getAppName(), MsgType.ERROR);
throw new BadRequestException("应用信息不存在:" + resources.getAppName());
}
String backupPath = app.getBackupPath()+FILE_SEPARATOR;
backupPath += resources.getAppName() + FILE_SEPARATOR + deployDate;
//这个是服务器部署路径
String deployPath = app.getDeployPath();
String ip = resources.getIp();
ExecuteShellUtil executeShellUtil = getExecuteShellUtil(ip);
String msg;
msg = String.format("登陆到服务器:%s", ip);
log.info(msg);
sendMsg(msg, MsgType.INFO);
sendMsg("停止原来应用", MsgType.INFO);
//停止应用
stopApp(app.getPort(), executeShellUtil);
//删除原来应用
sendMsg("删除应用", MsgType.INFO);
executeShellUtil.execute("rm -rf " + deployPath + FILE_SEPARATOR + resources.getAppName());View on GitHub (pinned to 55fbf70595)
Solutions
- Recreate or re-link the App for the referenced Deploy (set mnt_deploy.app_id), then retry the rollback.
- If the App is permanently gone, remove the orphan DeployHistory entries — rollback is impossible without the App's path configuration.
- Before rolling back, verify GET /api/deploy/<deployId> returns a record with a non-null app.
Example fix
// before: rollback an orphan history
deployService.serverReduction(history); // deployInfo.getApp() == null -> 应用信息不存在
// after: verify first
Deploy d = deployRepository.findById(history.getDeployId()).orElse(null);
if (d == null || d.getApp() == null) { /* fix data or abort with clear message */ }
deployService.serverReduction(history); Defensive patterns
Strategy: validation
Validate before calling
// Before rollback, verify the history's deploy still resolves to an App
Deploy deployInfo = deployRepository.findById(history.getDeployId()).orElse(null);
if (deployInfo == null || deployInfo.getApp() == null) {
throw new IllegalStateException("应用信息不存在:" + history.getAppName() + " — 无法回滚");
}
deployService.serverReduction(history); Type guard
boolean isRollbackable(DeployRepository repo, DeployHistory h) {
return h.getDeployId() != null
&& repo.findById(h.getDeployId()).map(d -> d.getApp() != null).orElse(false);
} Try / catch
try {
deployService.serverReduction(history);
} catch (BadRequestException e) {
if (e.getMessage().contains("应用信息不存在")) { notifyOpsOrphanHistory(history.getDeployId()); return; }
throw e;
} Prevention
- Block App deletion while Deploy/DeployHistory rows reference it, or cascade them.
- When restoring databases, restore mnt_app together with mnt_deploy/mnt_deploy_history to keep links intact.
- Validate deployId + app presence in the rollback UI before enabling the rollback button.
When it happens
Trigger: POST /api/deploy/serverReduction with a DeployHistory whose deployId points to a Deploy row with null/dangling app_id. Common when rolling back old history entries after the linked App was deleted.
Common situations: App deleted but its DeployHistory retained; deploy history restored from a backup into a schema where app rows are gone; manually edited history records with wrong deployId.
Related errors
AI-assisted analysis of elunez/eladmin@55fbf70595 (2026-08-14).
Data as JSON: /api/errors/33ace11f78c5ccbd.
Report an issue: GitHub.