apache/pulsar · error · IOException
Command Factory `${name}` does NOT provide a Command Factory
Error message
Command Factory `${name}` does NOT provide a Command Factory implementation What it means
NAR loading failure in CustomCommandFactoryProvider.load: the archive defined in the factory metadata was loaded, but its configuration/NAR does not yield a CustomCommandFactory implementation (missing or wrong service entry), so the CLI extension cannot be instantiated; the named NAR is the faulty artifact.
Source
Thrown at pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/utils/CustomCommandFactoryProvider.java:156
return ObjectMapperFactory.getYamlMapper().reader().readValue(
configStr, CustomCommandFactoryDefinition.class
);
}
@SuppressWarnings("unchecked")
private static CustomCommandFactory load(CustomCommandFactoryMetaData metadata,
String narExtractionDirectory)
throws IOException {
final File narFile = metadata.getArchivePath().toAbsolutePath().normalize().toFile();
NarClassLoader ncl = NarClassLoaderBuilder.builder()
.narFile(narFile)
.parentClassLoader(CustomCommandFactory.class.getClassLoader())
.extractionDirectory(narExtractionDirectory)
.build();
CustomCommandFactoryDefinition def = getCustomCommandFactoryDefinition(ncl);
if (StringUtils.isBlank(def.getFactoryClass())) {
throw new IOException("Command Factory `" + def.getName() + "` does NOT provide a Command Factory"
+ " implementation");
}
try {
Class commandFactoryClass = ncl.loadClass(def.getFactoryClass());
Object factory = commandFactoryClass.getDeclaredConstructor().newInstance();
if (!(factory instanceof CustomCommandFactory)) {
throw new IOException("Class " + def.getFactoryClass()
+ " does not implement CustomCommandFactory interface");
}
return (CustomCommandFactory) factory;
} catch (Exception e) {
if (e instanceof IOException) {
throw (IOException) e;
}
log.error().exception(e).attr("factoryClass", def.getFactoryClass())
.log("Failed to load class");
throw new IOException(e);View on GitHub (pinned to 820761864e)
Solutions
- Fix the factory definition in the NAR's config to name the implementation class
- Rebuild the extension NAR with a proper CustomCommandFactory implementation
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/utils/CustomCommandFactoryProvider.java:156 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/7b1e20f68d59926b.
Report an issue: GitHub.