{"record":{"id":"f0ff85a37eec78c5","repo":"pinpoint-apm/pinpoint","slug":"invalid-applicationname","errorCode":null,"errorMessage":"Invalid applicationName ","messagePattern":"Invalid applicationName ","errorType":"validation","errorClass":"ResponseStatusException","httpStatus":400,"severity":"error","filePath":"web/src/main/java/com/navercorp/pinpoint/web/util/ApplicationValidator.java","lineNumber":76,"sourceCode":"        validateName(applicationName);\n\n        ServiceType serviceType = null;\n        if (serviceTypeCode != undefined) {\n            serviceType = registry.findServiceType(serviceTypeCode);\n        }\n        if (StringUtils.hasLength(serviceTypeName)) {\n            serviceType = registry.findServiceTypeByName(serviceTypeName);\n        }\n        if (serviceType != null && serviceType.getCode() != undefined) {\n            return new Application(service, applicationName, serviceType);\n        }\n\n        throw new ResponseStatusException(HttpStatus.BAD_REQUEST, \"Invalid serviceTypeCode or serviceTypeName\");\n    }\n\n    public void validateName(String applicationName) {\n        if (!StringUtils.hasLength(applicationName) || !IdValidateUtils.validateId(applicationName, MAX_LENGTH)) {\n            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, \"Invalid applicationName \" + applicationName);\n        }\n    }\n}\n","sourceCodeStart":58,"sourceCodeEnd":80,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/web/src/main/java/com/navercorp/pinpoint/web/util/ApplicationValidator.java#L58-L80","documentation":"ApplicationValidator.validateName rejects application names that are empty or fail IdValidateUtils.validateId (character-set and length rules, MAX_LENGTH). It throws a 400 ResponseStatusException 'Invalid applicationName <name>' and all newApplication overloads call it first.","triggerScenarios":"Creating an application whose name is null/empty, contains characters outside the allowed ID set (spaces, non-ASCII, special chars), or exceeds the max length constant in ApplicationValidator.","commonSituations":"Application names derived from unvalidated user input or hostnames with dots/underscores; names longer than the limit after adding environment prefixes; localized (non-ASCII) app names; empty config value for the app name.","solutions":["Rename the application to match Pinpoint ID rules: alphanumeric plus allowed separators, within MAX_LENGTH","Check IdValidateUtils in web/src/main/java/com/navercorp/pinpoint/common/util for the exact allowed pattern and length","Strip or replace invalid characters (spaces, dots, unicode) before sending","Ensure the name isn't empty due to an unfilled config field"],"exampleFix":"// before\nnewApplication(\"my app.v2 (prod)\", \"STAND_ALONE\") // spaces/dots invalid\n// after\nnewApplication(\"my-app-v2-prod\", \"STAND_ALONE\")","handlingStrategy":"validation","validationCode":"// Mirror IdValidateUtils rules client-side\nfunction isValidApplicationName(name, maxLength) {\n  return typeof name === 'string' && name.length > 0 && name.length <= maxLength &&\n         /^[a-zA-Z0-9._\\-]+$/.test(name);\n}","typeGuard":"function isNonEmptyId(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().startsWith('Invalid applicationName')) {\n    // sanitize the name and retry\n  }\n  throw e;\n}","preventionTips":["Sanitize names derived from hostnames/user input (strip spaces, dots, unicode)","Check IdValidateUtils for the exact pattern and MAX_LENGTH","Trim environment prefixes so names stay within the length limit","Enforce ID rules at form/DTO level before any API call"],"tags":["http-400","validation","naming","identifier"],"backgroundTag":"invalid-identifier-format","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"}