OpenAPITools/openapi-generator · error · RuntimeException
Empty method name (operationId) not allowed
Error message
Empty method name (operationId) not allowed
What it means
XojoClientCodegen.toOperationId (line 429) camelize+sanitizeName's the operationId and then refuses an empty result. This happens when the spec's operationId (or the derived name) consists entirely of characters that sanitizeName strips, leaving nothing to build a Xojo method name from. The check is defensive — normal specs never hit it — but a RuntimeException is thrown because generation cannot continue without a method name.
Source
Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/XojoClientCodegen.java:429
if (sec.isApiKey) sec.name = toVarName(sec.name);
}
return securities;
}
@Override
public GeneratorLanguage generatorLanguage() {
return GeneratorLanguage.XOJO;
}
@Override
public String toOperationId(String operationId) {
operationId = camelize(sanitizeName(operationId));
// Throw exception if method name is empty.
// This should not happen but keep the check just in case
if (StringUtils.isEmpty(operationId)) {
throw new RuntimeException("Empty method name (operationId) not allowed");
}
// method name cannot use reserved keyword, e.g. return
if (isReservedWord(operationId)) {
String newOperationId = camelize(("Call_" + operationId));
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
return newOperationId;
}
// operationId starts with a number
if (operationId.matches("^\\d.*")) {
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId), LOWERCASE_FIRST_LETTER));
operationId = camelize(sanitizeName("Call_" + operationId));
}
return operationId;
}
View on GitHub (pinned to fcec517be3)
Solutions
- Open the spec and give every operation (paths -> verbs) a non-empty operationId containing at least one letter or digit (e.g. 'getUser').
- If operationIds look fine, check for operationIds made only of punctuation/whitespace or duplicated special characters after sanitization.
- Validate the spec with a linter (Swagger Editor / spectral) before generation to catch malformed identifiers.
Example fix
# before (openapi.yaml)
paths:
/users:
get:
operationId: "###"
# after
paths:
/users:
get:
operationId: getUser Defensive patterns
Strategy: validation
Validate before calling
// Node: reject operations whose operationId sanitizes to empty before generating
const spec = require('./openapi.json');
for (const [path, item] of Object.entries(spec.paths ?? {}))
for (const [verb, op] of Object.entries(item))
if (/^(get|put|post|delete|options|head|patch|trace)$/.test(verb)) {
const id = (op.operationId ?? '').replace(/[^a-zA-Z0-9]/g, '');
if (id.length === 0) throw new Error(`${verb.toUpperCase()} ${path}: empty/invalid operationId`);
} Try / catch
catch (RuntimeException e) {
// message names the offending operation path — fix the spec and regenerate
if (e.getMessage().contains("Empty method name (operationId) not allowed")) {
throw new SpecError("An operationId sanitized to empty; add a valid operationId to every operation", e);
}
throw e;
} Prevention
- Give every operation an explicit, unique operationId — never rely on derivation.
- Run spectral/Swagger Editor validation in CI to catch malformed identifiers early.
- Avoid operationIds made solely of punctuation, whitespace or symbols.
When it happens
Trigger: An OpenAPI operation with operationId: "###" or "///" (only special characters), or a missing operationId on a path whose auto-derived name sanitizes to empty. Only the Xojo generator path shown throws here, but any spec with such an operation is the root cause.
Common situations: Hand-edited specs where operationId was deleted instead of renamed; codegen'd specs from tools that emit symbol-only identifiers; specs with non-ASCII operationIds that sanitization strips to nothing.
Related errors
- Empty method name (operationId) not allowed
- Empty method name (operationId) not allowed
- operationId conflict during spec merge: '%s' (%s %s) is alre
- Empty method/operation name (operationId) not allowed
- Empty method name (operationId) not allowed
AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22).
Data as JSON: /api/errors/231063999aa4eaf4.
Report an issue: GitHub.