{"record":{"id":"394879bd073aedd0","repo":"pinpoint-apm/pinpoint","slug":"invalid-servicetypename","errorCode":null,"errorMessage":"Invalid serviceTypeName ","messagePattern":"Invalid serviceTypeName ","errorType":"validation","errorClass":"ResponseStatusException","httpStatus":400,"severity":"error","filePath":"web/src/main/java/com/navercorp/pinpoint/web/util/ApplicationValidator.java","lineNumber":43,"sourceCode":"\n    public ApplicationValidator(ServiceTypeRegistryService registry, int undefined) {\n        this.registry = Objects.requireNonNull(registry, \"registry\");\n        this.undefined = undefined;\n    }\n\n    public Application newApplication(String applicationName, int serviceTypeCode) {\n        validateName(applicationName);\n        if (serviceTypeCode == undefined) {\n            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, \"Invalid serviceTypeCode\" + serviceTypeCode);\n        }\n        ServiceType serviceType = registry.findServiceType(serviceTypeCode);\n        return new Application(applicationName, serviceType);\n    }\n\n    public Application newApplication(String applicationName, String serviceTypeName) {\n        validateName(applicationName);\n        if (!StringUtils.hasLength(serviceTypeName)) {\n            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, \"Invalid serviceTypeName \" + serviceTypeName);\n        }\n        ServiceType serviceType = registry.findServiceTypeByName(serviceTypeName);\n        if (serviceType.getCode() == undefined) {\n            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, \"Invalid serviceTypeName \" + serviceTypeName);\n        }\n        return new Application(applicationName, serviceType);\n    }\n\n    public Application newApplication(String applicationName, int serviceTypeCode, String serviceTypeName) {\n        return newApplication(Service.DEFAULT, applicationName, serviceTypeCode, serviceTypeName);\n    }\n\n    public Application newApplication(Service service, String applicationName, int serviceTypeCode, String serviceTypeName) {\n        Objects.requireNonNull(service, \"service\");\n        validateName(applicationName);\n\n        ServiceType serviceType = null;\n        if (serviceTypeCode != undefined) {","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/web/src/main/java/com/navercorp/pinpoint/web/util/ApplicationValidator.java#L25-L61","documentation":"ApplicationValidator.newApplication(name, serviceTypeName) throws a 400 ResponseStatusException when serviceTypeName is null/empty (StringUtils.hasLength fails). It rejects the request before consulting the service type registry.","triggerScenarios":"Building/POSTing an Application with serviceTypeName missing, empty string, or whitespace-only value; the empty check runs before name lookup, so this fires even before the undefined-code check on the same message.","commonSituations":"Config where the service type name is pulled from an env var or properties file that is unset/blank; JSON payloads omitting the field; scripts quoting an empty variable.","solutions":["Provide a valid serviceTypeName (e.g. STAND_ALONE, TOMCAT) in the request/config","Print/log the source of the value (env var, config file) and fix the empty source","Use the serviceTypeCode-based overload if you know the numeric code instead","Verify case-sensitive spelling against GET /serviceTypeInfo"],"exampleFix":"// before\nnewApplication(\"myApp\", \"\")\n// after\nnewApplication(\"myApp\", \"STAND_ALONE\")","handlingStrategy":"validation","validationCode":"if (!serviceTypeName || serviceTypeName.trim().length === 0) {\n  throw new Error('serviceTypeName must be a non-empty string');\n}","typeGuard":"function hasServiceTypeName(v) {\n  return typeof v === 'string' && v.trim().length > 0;\n}","tryCatchPattern":"try {\n  const app = newApplication(name, serviceTypeName);\n} catch (e) {\n  if (e instanceof ResponseStatusException && e.getMessage().contains('Invalid serviceTypeName')) {\n    // supply a default type or abort config load\n  }\n  throw e;\n}","preventionTips":["Validate config/env sources so serviceTypeName is never blank","Use hasText-style checks (trim) before sending whitespace-only values","Provide a sensible default service type in templates","Log the config key that produced the empty value"],"tags":["http-400","service-type","validation","empty-value"],"backgroundTag":"empty-required-field","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"}