karatelabs/karate · error · RuntimeException

missing argument for paramValues()

Error message

missing argument for paramValues()

What it means

The request.paramValues() invokable requires one argument (the parameter name) and returns all values for it. Called with zero arguments it throws RuntimeException 'missing argument for paramValues()'.

Solutions

  1. Pass the parameter name: request.paramValues('tag')
  2. Ensure the source of the name (variable/config) is populated before the call
  3. Use the correct no-arg API if one exists for listing all parameters

Example fix

// before
var vs = request.paramValues();
// after
var vs = request.paramValues('tag');
Defensive patterns

Strategy: type-guard

Validate before calling

if (name == null || name.isEmpty()) throw new IllegalArgumentException("param name required");

Type guard

function requireArg(name, args) { if (args == null || args.length === 0) throw new Error('missing argument for paramValues()'); return name; }

Try / catch

try { var vs = request.paramValues('tag'); } catch (RuntimeException e) { /* fix call site: name argument missing */ }

Prevention

When it happens

Trigger: Calling request.paramValues() with no arguments instead of request.paramValues('name').

Common situations: Same as param(): omitted argument during hand-editing, empty variable interpolated into a script, misunderstanding that the method lists all params when called bare.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of karatelabs/karate@a22eb90246 (2026-09-12). Data as JSON: /api/errors/191982390e7289e3. Report an issue: GitHub.

Appendix: source

Thrown at karate-core/src/main/java/io/karatelabs/http/HttpRequest.java:553

        return builder;
    }

    private JavaInvokable param() {
        return args -> {
            if (args.length > 0) {
                return getParam(args[0] + "");
            } else {
                throw new RuntimeException("missing argument for param()");
            }
        };
    }

    private JavaInvokable paramValues() {
        return args -> {
            if (args.length > 0) {
                return getParamValues(args[0] + "");
            } else {
                throw new RuntimeException("missing argument for paramValues()");
            }
        };
    }

    private JavaInvokable paramInt() {
        return args -> {
            if (args.length > 0) {
                String val = getParam(args[0] + "");
                return val == null ? null : Integer.parseInt(val);
            } else {
                throw new RuntimeException("missing argument for paramInt()");
            }
        };
    }

    private JavaInvokable paramJson() {
        return args -> {
            if (args.length > 0) {

View on GitHub (pinned to a22eb90246)