elunez/eladmin · error · BadRequestException

包对应应用信息不存在

Error message

包对应应用信息不存在

What it means

Immediately after the deploy-record check, DeployServiceImpl.deployApp requires deploy.getApp() to be non-null; a Deploy entry with no associated App throws '包对应应用信息不存在' (WebSocket message + BadRequestException). The App carries port/paths needed to build the deploy shell commands, so deployment cannot continue.

Source

Thrown at eladmin-system/src/main/java/me/zhengjie/modules/maint/service/impl/DeployServiceImpl.java:130

	public void deploy(String fileSavePath, Long id) {
		deployApp(fileSavePath, id);
	}

	/**
	 * @param fileSavePath 本机路径
	 * @param id ID
	 */
	private void deployApp(String fileSavePath, Long id) {

		DeployDto deploy = findById(id);
		if (deploy == null) {
			sendMsg("部署信息不存在", MsgType.ERROR);
			throw new BadRequestException("部署信息不存在");
		}
		AppDto app = deploy.getApp();
		if (app == null) {
			sendMsg("包对应应用信息不存在", MsgType.ERROR);
			throw new BadRequestException("包对应应用信息不存在");
		}
		int port = app.getPort();
		//这个是服务器部署路径
		String uploadPath = app.getUploadPath();
		StringBuilder sb = new StringBuilder();
		String msg;
		Set<ServerDeployDto> deploys = deploy.getDeploys();
		for (ServerDeployDto deployDTO : deploys) {
			String ip = deployDTO.getIp();
			ExecuteShellUtil executeShellUtil = getExecuteShellUtil(ip);
			//判断是否第一次部署
			boolean flag = checkFile(executeShellUtil, app);
			//第一步要确认服务器上有这个目录
			executeShellUtil.execute("mkdir -p " + app.getUploadPath());
			executeShellUtil.execute("mkdir -p " + app.getBackupPath());
			executeShellUtil.execute("mkdir -p " + app.getDeployPath());
			//上传文件
			msg = String.format("登陆到服务器:%s", ip);

View on GitHub (pinned to 55fbf70595)

Solutions

  1. Edit the Deploy record in the UI and (re)select the application it should deploy, then retry.
  2. If the App was deleted, recreate it or delete the orphaned Deploy entry and create a fresh one.
  3. Data-hygiene fix: clean orphan mnt_deploy rows (app_id null or dangling) so the list contains only deployable entries.

Example fix

-- before: orphan deploy row
SELECT id FROM mnt_deploy WHERE app_id IS NULL;  -- id=5 keeps failing

-- after: re-link or remove
UPDATE mnt_deploy SET app_id = 3 WHERE id = 5;  -- or DELETE FROM mnt_deploy WHERE id = 5;
Defensive patterns

Strategy: validation

Validate before calling

// Ensure the Deploy has an App attached before deploying
DeployDto deploy = deployService.findById(id);
if (deploy == null) throw new IllegalStateException("部署信息不存在");
if (deploy.getApp() == null) throw new IllegalStateException("包对应应用信息不存在: 请为该部署关联应用");
deployService.deploy(fileSavePath, id);

Type guard

boolean isDeployable(DeployDto d) {
    return d != null && d.getApp() != null && d.getApp().getId() != null;
}

Try / catch

try {
    deployService.deploy(path, id);
} catch (BadRequestException e) {
    if ("包对应应用信息不存在".equals(e.getMessage())) { fixDeployAppLink(id); return; }
    throw e;
}

Prevention

When it happens

Trigger: Deploying a Deploy record whose app_id is null — e.g. the App was deleted but the Deploy row remained, or the Deploy was created without selecting an application in the UI/API.

Common situations: Deleting an App without cascading to its Deploy entries (foreign key not enforced); data imported/restored inconsistently; API-created Deploys missing the app field.

Related errors


AI-assisted analysis of elunez/eladmin@55fbf70595 (2026-08-14). Data as JSON: /api/errors/4f72e70f16776c30. Report an issue: GitHub.