pinpoint-apm/pinpoint · error · ResponseStatusException

Invalid applicationName

Error message

Invalid applicationName 

What it means

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.

Source

Thrown at web/src/main/java/com/navercorp/pinpoint/web/util/ApplicationValidator.java:76

        validateName(applicationName);

        ServiceType serviceType = null;
        if (serviceTypeCode != undefined) {
            serviceType = registry.findServiceType(serviceTypeCode);
        }
        if (StringUtils.hasLength(serviceTypeName)) {
            serviceType = registry.findServiceTypeByName(serviceTypeName);
        }
        if (serviceType != null && serviceType.getCode() != undefined) {
            return new Application(service, applicationName, serviceType);
        }

        throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid serviceTypeCode or serviceTypeName");
    }

    public void validateName(String applicationName) {
        if (!StringUtils.hasLength(applicationName) || !IdValidateUtils.validateId(applicationName, MAX_LENGTH)) {
            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid applicationName " + applicationName);
        }
    }
}

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Rename the application to match Pinpoint ID rules: alphanumeric plus allowed separators, within MAX_LENGTH
  2. Check IdValidateUtils in web/src/main/java/com/navercorp/pinpoint/common/util for the exact allowed pattern and length
  3. Strip or replace invalid characters (spaces, dots, unicode) before sending
  4. Ensure the name isn't empty due to an unfilled config field

Example fix

// before
newApplication("my app.v2 (prod)", "STAND_ALONE") // spaces/dots invalid
// after
newApplication("my-app-v2-prod", "STAND_ALONE")
Defensive patterns

Strategy: validation

Validate before calling

// Mirror IdValidateUtils rules client-side
function isValidApplicationName(name, maxLength) {
  return typeof name === 'string' && name.length > 0 && name.length <= maxLength &&
         /^[a-zA-Z0-9._\-]+$/.test(name);
}

Type guard

function isNonEmptyId(v) {
  return typeof v === 'string' && v.trim().length > 0;
}

Try / catch

try {
  const app = newApplication(name, serviceTypeName);
} catch (e) {
  if (e instanceof ResponseStatusException && e.getMessage().startsWith('Invalid applicationName')) {
    // sanitize the name and retry
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/f0ff85a37eec78c5. Report an issue: GitHub.