{"record":{"id":"4f72e70f16776c30","repo":"elunez/eladmin","slug":"error-4f72e7","errorCode":null,"errorMessage":"包对应应用信息不存在","messagePattern":"包对应应用信息不存在","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"eladmin-system/src/main/java/me/zhengjie/modules/maint/service/impl/DeployServiceImpl.java","lineNumber":130,"sourceCode":"\tpublic void deploy(String fileSavePath, Long id) {\n\t\tdeployApp(fileSavePath, id);\n\t}\n\n\t/**\n\t * @param fileSavePath 本机路径\n\t * @param id ID\n\t */\n\tprivate void deployApp(String fileSavePath, Long id) {\n\n\t\tDeployDto deploy = findById(id);\n\t\tif (deploy == null) {\n\t\t\tsendMsg(\"部署信息不存在\", MsgType.ERROR);\n\t\t\tthrow new BadRequestException(\"部署信息不存在\");\n\t\t}\n\t\tAppDto app = deploy.getApp();\n\t\tif (app == null) {\n\t\t\tsendMsg(\"包对应应用信息不存在\", MsgType.ERROR);\n\t\t\tthrow new BadRequestException(\"包对应应用信息不存在\");\n\t\t}\n\t\tint port = app.getPort();\n\t\t//这个是服务器部署路径\n\t\tString uploadPath = app.getUploadPath();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tString msg;\n\t\tSet<ServerDeployDto> deploys = deploy.getDeploys();\n\t\tfor (ServerDeployDto deployDTO : deploys) {\n\t\t\tString ip = deployDTO.getIp();\n\t\t\tExecuteShellUtil executeShellUtil = getExecuteShellUtil(ip);\n\t\t\t//判断是否第一次部署\n\t\t\tboolean flag = checkFile(executeShellUtil, app);\n\t\t\t//第一步要确认服务器上有这个目录\n\t\t\texecuteShellUtil.execute(\"mkdir -p \" + app.getUploadPath());\n\t\t\texecuteShellUtil.execute(\"mkdir -p \" + app.getBackupPath());\n\t\t\texecuteShellUtil.execute(\"mkdir -p \" + app.getDeployPath());\n\t\t\t//上传文件\n\t\t\tmsg = String.format(\"登陆到服务器:%s\", ip);","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/elunez/eladmin/blob/55fbf705956949697dbd68bf9003776609d3d029/eladmin-system/src/main/java/me/zhengjie/modules/maint/service/impl/DeployServiceImpl.java#L112-L148","documentation":"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.","triggerScenarios":"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.","commonSituations":"Deleting an App without cascading to its Deploy entries (foreign key not enforced); data imported/restored inconsistently; API-created Deploys missing the app field.","solutions":["Edit the Deploy record in the UI and (re)select the application it should deploy, then retry.","If the App was deleted, recreate it or delete the orphaned Deploy entry and create a fresh one.","Data-hygiene fix: clean orphan mnt_deploy rows (app_id null or dangling) so the list contains only deployable entries."],"exampleFix":"-- before: orphan deploy row\nSELECT id FROM mnt_deploy WHERE app_id IS NULL;  -- id=5 keeps failing\n\n-- after: re-link or remove\nUPDATE mnt_deploy SET app_id = 3 WHERE id = 5;  -- or DELETE FROM mnt_deploy WHERE id = 5;","handlingStrategy":"validation","validationCode":"// Ensure the Deploy has an App attached before deploying\nDeployDto deploy = deployService.findById(id);\nif (deploy == null) throw new IllegalStateException(\"部署信息不存在\");\nif (deploy.getApp() == null) throw new IllegalStateException(\"包对应应用信息不存在: 请为该部署关联应用\");\ndeployService.deploy(fileSavePath, id);","typeGuard":"boolean isDeployable(DeployDto d) {\n    return d != null && d.getApp() != null && d.getApp().getId() != null;\n}","tryCatchPattern":"try {\n    deployService.deploy(path, id);\n} catch (BadRequestException e) {\n    if (\"包对应应用信息不存在\".equals(e.getMessage())) { fixDeployAppLink(id); return; }\n    throw e;\n}","preventionTips":["Require the app field when creating Deploy records (UI + API validation).","Cascade-delete or block deletion of Apps still referenced by Deploy entries.","Periodically audit mnt_deploy for null/dangling app_id rows."],"tags":["deployment","data-integrity","not-found","eladmin","maintenance"],"backgroundTag":null,"analyzedSha":"55fbf705956949697dbd68bf9003776609d3d029","analyzedAt":"2026-08-14T11:56:12.758Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}