elunez/eladmin · error · BadRequestException

IP对应服务器信息不存在:{ip}

Error message

IP对应服务器信息不存在:{ip}

What it means

Thrown by DeployServiceImpl.getExecuteShellUtil when serverDeployService.findByIp(ip) returns null, meaning no ServerDeploy record exists for the given IP in the server_deploy table. Before constructing the ExecuteShellUtil SSH session, the code looks up the SSH account/password/port for that IP and aborts if the server is unregistered. A BadRequestException (HTTP 400) is thrown after a websocket message is pushed to the deploy UI.

Source

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

			result = checkIsRunningStatus(app.getPort(), executeShellUtil);
			if(result){
				break;
			}
			// 休眠6秒
			sleep(6);
		}
		StringBuilder sb = new StringBuilder();
		sb.append("服务器:").append(ip).append("<br>应用:").append(resources.getAppName());
		sendResultMsg(result, sb);
		executeShellUtil.close();
		return "";
	}

	private ExecuteShellUtil getExecuteShellUtil(String ip) {
		ServerDeployDto serverDeployDTO = serverDeployService.findByIp(ip);
		if (serverDeployDTO == null) {
			sendMsg("IP对应服务器信息不存在:" + ip, MsgType.ERROR);
			throw new BadRequestException("IP对应服务器信息不存在:" + ip);
		}
		return new ExecuteShellUtil(ip, serverDeployDTO.getAccount(), serverDeployDTO.getPassword(),serverDeployDTO.getPort());
	}

	private ScpClientUtil getScpClientUtil(String ip) {
		ServerDeployDto serverDeployDTO = serverDeployService.findByIp(ip);
		if (serverDeployDTO == null) {
			sendMsg("IP对应服务器信息不存在:" + ip, MsgType.ERROR);
			throw new BadRequestException("IP对应服务器信息不存在:" + ip);
		}
		return ScpClientUtil.getInstance(ip, serverDeployDTO.getPort(), serverDeployDTO.getAccount(), serverDeployDTO.getPassword());
	}

	private void sendResultMsg(boolean result, StringBuilder sb) {
		if (result) {
			sb.append("<br>启动成功!");
			sendMsg(sb.toString(), MsgType.INFO);
		} else {

View on GitHub (pinned to 55fbf70595)

Solutions

  1. Add or fix the server record in ServerDeploy (运维 -> 服务器管理) so its IP exactly matches the one configured on the application being deployed.
  2. Check the application's serverIds/IP list (deploy_app table) and remove stale IPs left over from server migrations.
  3. Verify there is no trailing whitespace/format difference between the stored IP and the one passed in (findByIp is exact match).

Example fix

// before: deploying with an IP that has no ServerDeploy row
// after: pre-verify the server is registered before triggering deploy
ServerDeployDto dto = serverDeployService.findByIp(ip);
if (dto == null) {
    // create the record via POST /api/serverDeploy or fix deploy_app.server_ip
}
Defensive patterns

Strategy: validation

Validate before calling

// before triggering a deploy, verify every target IP is registered
ServerDeployDto dto = serverDeployService.findByIp(ip);
if (dto == null) {
    throw new IllegalArgumentException("Server not registered: " + ip + " - add it in 服务器管理 first");
}

Try / catch

try { deployService.deploy(...) } catch (BadRequestException e) { if (e.getMessage().contains("IP对应服务器信息不存在")) { prompt user to register server " + e.getMessage(); } throw e; }

Prevention

When it happens

Trigger: Calling the deployment endpoints (deploy, server-deploy app deployment flows) with an app's server IP list containing an IP that has no matching row in server_deploy. The IP string must match exactly (findByIp does an exact-match query), so a mismatch in whitespace, hostname-vs-IP, or changed server address triggers it.

Common situations: A new application is registered and deployed to a server that was never added under 运维/服务器管理; the server record was deleted or its IP changed after a migration; the app's saved deploy config still references an old IP.

Related errors


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