JetBrains/intellij-community · error · ConfigurationException
error.short.name.module.cannot.be.empty
error.short.name.module.cannot.be.empty
Error message
Module short name cannot be empty
What it means
Thrown from ModuleConfigurable.checkName() when renaming a module to a full name whose shortened (group-stripped) form is empty. Module names may use dotted group paths like 'group.sub.name'; ModuleGrouper.getShortenedNameByFullModuleName removes group prefixes, and a name consisting only of group separators (e.g. a trailing dot) leaves an empty short name, which is invalid.
Source
Thrown at java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleConfigurable.java:68
if (StringUtil.isEmpty(name)) return; //empty string comes on double click on module node
if (Comparing.strEqual(name, myModuleName)) return; //nothing changed
try {
modifiableModuleModel.renameModule(myModule, name);
}
catch (ModuleWithNameAlreadyExists moduleWithNameAlreadyExists) {
//do nothing
}
myConfigurator.moduleRenamed(myModule, myModuleName, name);
myModuleName = name;
myConfigurator.setModified(!Comparing.strEqual(myModuleName, myModule.getName()));
myContext.getDaemonAnalyzer().queueUpdateForAllElementsWithErrors();
}
@Override
protected void checkName(@NotNull String name) throws ConfigurationException {
super.checkName(name);
if (myModuleGrouper.getShortenedNameByFullModuleName(name).isEmpty()) {
throw new ConfigurationException(LangBundle.message("error.short.name.module.cannot.be.empty"));
}
List<String> list = myModuleGrouper.getGroupPathByModuleName(name);
if (list.stream().anyMatch(String::isEmpty)) {
throw new ConfigurationException(LangBundle.message("error.names.of.parent.groups.cannot.be.empty"));
}
}
public ModuleGrouper getModuleGrouper() {
return myModuleGrouper;
}
@Override
public ProjectStructureElement getProjectStructureElement() {
return myProjectStructureElement;
}
@Override
public @NotNull Module getEditableObject() {View on GitHub (pinned to be881553f2)
Solutions
- Change the module name so the last dot-separated segment is non-empty (e.g. 'mygroup.mymodule' instead of 'mygroup.')
- Avoid leading/trailing dots in module names
Defensive patterns
Strategy: validation
Validate before calling
String shortName = ModuleGrouper.getShortenedNameByFullModuleName(newName);
if (shortName.isEmpty()) reject("module short name cannot be empty"); Try / catch
try { moduleConfigurable.checkName(name); } catch (ConfigurationException e) { /* show message, keep editor open */ } Prevention
- Never end a module name with '.'
- When generating grouped names, assert the last dotted segment is non-empty
When it happens
Trigger: Renaming a module in Project Structure to a value whose short name after group stripping is empty, such as '.' or 'a.'. ModuleGrouper.getShortenedNameByFullModuleName(name) returns an empty string.
Common situations: Typo in module rename (trailing dot, only dots); pasting a name with an invisible trailing separator; scripted renames generating malformed dotted names.
Related errors
- error.names.of.parent.groups.cannot.be.empty
- module.paths.validation.source.root.belongs.to.another.module.error
- Offset out of range (from -12:00 to +14:00)
- Enter module file location
- Enter a module name
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/afd72ebcafccfc96.
Report an issue: GitHub.