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

  1. Pass a non-empty extension short name, e.g. boot.ext('myext').
  2. Default or validate the variable feeding the call before boot.ext executes.
  3. 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

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


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)