{"record":{"id":"5b23dd99591641f7","repo":"pinpoint-apm/pinpoint","slug":"undefined-service-type","errorCode":null,"errorMessage":"Undefined service type","messagePattern":"Undefined service type","errorType":"http","errorClass":"ResponseStatusException","httpStatus":400,"severity":"error","filePath":"web/src/main/java/com/navercorp/pinpoint/web/authorization/controller/AdminController.java","lineNumber":90,"sourceCode":"        logger.info(\"Removing application - applicationName: [{}]\", applicationName);\n        try {\n            this.adminService.removeApplicationName(applicationName);\n            return \"OK\";\n        } catch (Exception e) {\n            logger.error(\"error while removing applicationName\", e);\n            throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage());\n        }\n    }\n\n    @DeleteMapping(value = \"/applications\")\n    public String removeApplication(@ServiceParam ServiceName serviceName,\n                                    @RequestParam(\"applicationName\") @NotBlank String applicationName,\n                                    @RequestParam(value = \"serviceTypeCode\", required = false) Integer serviceTypeCode,\n                                    @RequestParam(value = \"serviceTypeName\", required = false) String serviceTypeName) {\n        Service service = serviceModelResolver.getService(serviceName.getName());\n        Application application = getApplication(service, applicationName, serviceTypeCode, serviceTypeName);\n        if (application.getServiceType().equals(ServiceType.UNDEFINED)) {\n            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, \"Undefined service type\");\n        }\n        logger.info(\"Removing application - application: {}\", application);\n        try {\n            this.adminService.removeApplication(application.getService(), application.getApplicationName(), application.getServiceTypeCode());\n            return \"OK\";\n        } catch (Exception e) {\n            logger.error(\"error while removing application\", e);\n            throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage());\n        }\n    }\n\n    @Deprecated\n    @RequestMapping(value = \"/removeAgentId\", params = {\"!serviceTypeCode\", \"!serviceTypeName\"})\n    public String removeAgentId(\n            @RequestParam(value = \"applicationName\") @NotBlank String applicationName,\n            @RequestParam(value = \"agentId\") @NotBlank String agentId\n    ) {\n        logger.info(\"Removing agent - applicationName: [{}], agentId: [{}]\", applicationName, agentId);","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/web/src/main/java/com/navercorp/pinpoint/web/authorization/controller/AdminController.java#L72-L108","documentation":"AdminController.removeApplication resolves the application's ServiceType from the provided serviceTypeCode or serviceTypeName via the application factory. If neither is supplied (or they don't match a known service type), the resolved Application has ServiceType.UNDEFINED and the controller rejects the request with HTTP 400 'Undefined service type'. The admin delete APIs require an explicit, resolvable service type.","triggerScenarios":"Calling the /applications DELETE endpoint without serviceTypeCode and without serviceTypeName, or with a code/name that does not map to a registered ServiceType — e.g. serviceTypeName=UNKNOWN_APP or an unregistered code.","commonSituations":"Calling the newer @DeleteMapping API but porting only the old parameters (applicationName only, as the deprecated endpoint allowed); misspelling the service type name; case differences; the service type exists in the agent but is not registered in Web's serviceType registry (missing typescript/properties in service-type descriptors).","solutions":["Pass a resolvable service type: add either serviceTypeCode (e.g. 1010) or serviceTypeName (e.g. TOMCAT) matching the application","Get the exact code/name from the Pinpoint UI inspector or the service-types registry to avoid case/spelling mismatch","If the type is custom, register its descriptor in Web's service type configuration so it stops resolving to UNDEFINED","If you intentionally want the legacy behavior, use the deprecated /admin/removeApplication endpoint (though supplying the type is safer)"],"exampleFix":"// before\nDELETE /admin/applications?applicationName=MyApp            -> 400 Undefined service type\n// after\nDELETE /admin/applications?applicationName=MyApp&serviceTypeName=TOMCAT","handlingStrategy":"validation","validationCode":"if (serviceTypeCode == null && !serviceTypeName) {\n  throw new Error('Either serviceTypeCode or serviceTypeName is required');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await adminApi.removeApplication({ applicationName, serviceTypeName });\n} catch (e) {\n  if (e.status === 400 && String(e.message).includes('Undefined service type')) {\n    throw new Error('Supply a valid serviceTypeCode/serviceTypeName, e.g. TOMCAT (1010)');\n  }\n  throw e;\n}","preventionTips":["Always send serviceTypeCode or serviceTypeName with the new /admin/applications DELETE API","Copy the exact code/name from the Pinpoint UI application list","Register custom service types in the Web service-type registry","Prefer serviceTypeCode over name to avoid case-sensitivity mistakes"],"tags":["bad-request","service-type","admin","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}