OpenAPITools/openapi-generator · error · RuntimeException
Empty database/table/column name for property '{name}' not a
Error message
Empty database/table/column name for property '{name}' not allowed What it means
The Ktorm schema generator derives database/table/column names from OpenAPI identifiers and sanitizes them (stripping illegal characters, trailing whitespace, etc.). If sanitization reduces a name to the empty string, escapeDatabaseName throws 'Empty database/table/column name for property ... not allowed' (KtormSchemaCodegen.java:1079) because an identifier-less column cannot be emitted. Earlier conditions (trailing spaces, all-digit names) are only warned about and repaired; emptiness is fatal.
Source
Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KtormSchemaCodegen.java:1079
* @return identifier name
*/
public String toIdentifier(String name, String prefix, String suffix) {
String escapedName = escapeQuotedIdentifier(name);
// Database, table, and column names cannot end with space characters.
if (escapedName.matches(".*\\s$")) {
LOGGER.warn("Database, table, and column names cannot end with space characters. Check '{}' name", name);
escapedName = escapedName.replaceAll("\\s+$", "");
}
// Identifiers may begin with a digit but unless quoted may not consist solely of digits.
if (escapedName.matches("^\\d+$")) {
LOGGER.warn("Database, table, and column names cannot consist solely of digits. Check '{}' name", name);
escapedName = prefix + escapedName + suffix;
}
// identifier name cannot be empty
if (escapedName.isEmpty()) {
throw new RuntimeException("Empty database/table/column name for property '" + name + "' not allowed");
}
return escapedName;
}
/**
* Escapes identifier to use it in SQL statements with backticks, eg. SELECT "identifier" FROM
* Ref: https://www.sqlite.org/draft/tokenreq.html H41130
* Spec is similar to MySQL
*
* @param identifier source identifier
* @return escaped identifier
*/
public String escapeQuotedIdentifier(String identifier) {
// ASCII: [0-9,a-z,A-Z$_] (basic Latin letters, digits 0-9, dollar, underscore) Extended: U+0080 .. U+FFFF
// ASCII NUL (U+0000) and supplementary characters (U+10000 and higher) are not permitted in quoted or unquoted identifiers.
// This does in fact matches against >\xFFFF and against ^\x0000. works only on Java7+
Pattern regexp = Pattern.compile("[^0-9a-zA-z$_\\x0080-\\xFFFF]");
Matcher matcher = regexp.matcher(identifier);View on GitHub (pinned to fcec517be3)
Solutions
- Rename the offending property (the message includes the property name) to start with a letter or underscore and contain word characters.
- Lint the spec for identifiers that contain no [A-Za-z0-9_] characters before generation.
- If the symbolic name is mandated upstream, map it via a saner property name plus `x-` vendor extension or spec preprocessing.
Example fix
# before (api.yaml)
components:
schemas:
Row:
properties:
"###": { type: string }
# after
components:
schemas:
Row:
properties:
hash_prefix: { type: string } Defensive patterns
Strategy: validation
Validate before calling
// reject identifiers that sanitize to nothing before generation
Pattern wordChars = Pattern.compile("[^\\w]");
void checkIdentifiers(Map<String, Schema> props, String schemaName) {
for (String key : props.keySet()) {
if (wordChars.matcher(key).replaceAll("").isEmpty()) {
throw new IllegalArgumentException(
"Property '" + key + "' in '" + schemaName + "' has no valid identifier characters");
}
}
} Try / catch
try {
new DefaultGenerator().opts(clientOptInput).generate();
} catch (RuntimeException e) {
// message contains the offending property name; rename it in the spec and retry
throw new BuildException("Ktorm schema generation failed: " + e.getMessage(), e);
} Prevention
- Require property keys to match ^[A-Za-z_][A-Za-z0-9_]*$ in spec lint.
- Never use symbols-only placeholder names when editing specs by hand.
- Sanity-check spreadsheet-to-OpenAPI exports for symbolic column headers.
When it happens
Trigger: A schema property, model, or vendor-extension table/column name whose characters are all stripped during escaping — e.g. a property named `###`, `$`, `***`, or one made solely of whitespace/punctuation — reaching escapeDatabaseName() during ktorm schema generation.
Common situations: Hand-edited specs with placeholder names; specs generated from external systems where a field's display name is pure symbols; rename scripts that mangle property keys; properties whose name consists only of characters illegal in SQL identifiers.
Related errors
- Empty database/table/column name for property '{name}' not a
- Empty database/table/column name for property '{name}' not a
- The BLOB and JSON data types cannot be assigned a default va
- The BLOB, TEXT, GEOMETRY, and JSON data types cannot be assi
- The BLOB, TEXT, GEOMETRY, and JSON data types cannot be assi
AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22).
Data as JSON: /api/errors/44722cbb948f0830.
Report an issue: GitHub.