karatelabs/karate · error · IllegalArgumentException
boot.ext: name is null or empty
Error message
boot.ext: name is null or empty
What it means
BootBinding.ext(name) loads a karate extension by name-convention class resolution, and a null or blank name cannot be resolved, so an IllegalArgumentException is thrown immediately. Extension names are looked up as singletons per Suite; the name drives the fully-qualified class name construction.
Solutions
- Pass a non-empty extension short name, e.g. boot.ext('myext').
- Default or validate the variable feeding the call before boot.ext executes.
- Remove the boot.ext call entirely if no extension is needed for this suite.
Example fix
// before
var extName = karate.properties.get('karate.ext'); boot.ext(extName); // may be null
// after
var extName = karate.properties.get('karate.ext');
if (extName) boot.ext(extName); Defensive patterns
Strategy: validation
Validate before calling
// before calling boot.ext(name)
if (name == null || name.isBlank()) throw new IllegalArgumentException("extension name required"); Prevention
- Provide defaults for extension names read from properties/env.
- Skip boot.ext entirely when no extension is configured.
- Use literal extension names in boot scripts.
When it happens
Trigger: Calling boot.ext(null), boot.ext(''), or boot.ext(' ') — directly or via a variable that is null/empty at boot time.
Common situations: Extension name supplied from config/env that is unset; typo leaving an empty string; generated boot config where the ext name placeholder was never filled.
Related errors
- boot.classpath: dir is null — pass a project-relative…
- boot.read: path is null
- boot.ext(' '): does not implement io.karatelabs.core.Ext
- boot.ext(' '): not on classpath. Expected (name-convention…
- boot.ext(' '): failed to construct
AI-assisted analysis of karatelabs/karate@a22eb90246 (2026-09-12).
Data as JSON: /api/errors/0864b9f984fef509.
Report an issue: GitHub.
Appendix: source
Thrown at karate-core/src/main/java/io/karatelabs/core/BootBinding.java:213
}
/** {@code boot.log('...')} — INFO log with [boot] prefix. */
public void log(Object msg) {
logger.info("[boot] {}", msg == null ? "null" : msg.toString());
}
/**
* {@code boot.ext('name')} — resolve + construct + register an ext.
*
* <p>Resolution by name convention: {@code 'openapi'} →
* {@code io.karatelabs.ext.openapi.OpenapiExt}. The class is loaded from
* the runtime classloader; missing ext → boot-time failure (suite fails loud).</p>
*
* <p>Same name twice returns the same singleton instance.</p>
*/
public Ext ext(String name) {
if (name == null || name.isBlank()) {
throw new IllegalArgumentException("boot.ext: name is null or empty");
}
// Singleton-per-name within this BootBinding (which is itself per-Suite).
for (Ext existing : exts) {
if (name.equals(extShortName(existing))) {
return existing;
}
}
String className = extClassName(name);
Ext ext;
try {
Class<?> cls = Class.forName(className);
Object instance = cls.getDeclaredConstructor().newInstance();
if (!(instance instanceof Ext)) {
throw new RuntimeException(
"boot.ext('" + name + "'): " + className
+ " does not implement io.karatelabs.core.Ext");
}
ext = (Ext) instance;View on GitHub (pinned to a22eb90246)