{"record":{"id":"126882f6aa448d4c","repo":"karatelabs/karate","slug":"feature-path-is-required","errorCode":null,"errorMessage":"feature path is required","messagePattern":"feature path is required","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"karate-gatling/src/main/java/io/karatelabs/gatling/KarateFeatureBuilder.java","lineNumber":72,"sourceCode":" * on the Gatling scenario rather than passing multiple paths here.\n */\npublic final class KarateFeatureBuilder implements ActionBuilder {\n\n    private final String featurePath;\n    private final List<String> tags = new ArrayList<>();\n    private boolean silent = false;\n    private KarateProtocol protocol;\n\n    /**\n     * Create a builder for the given feature path with optional tag selectors.\n     *\n     * @param path feature file path (e.g., \"classpath:features/cats.feature\")\n     * @param tags tag selector expressions (e.g., \"@smoke\", \"~@slow\") — varargs;\n     *             multiple values are AND-ed together, commas within a value are OR\n     */\n    public KarateFeatureBuilder(String path, String... tags) {\n        if (path == null || path.isEmpty()) {\n            throw new IllegalArgumentException(\"feature path is required\");\n        }\n        this.featurePath = path;\n        if (tags != null) {\n            Collections.addAll(this.tags, tags);\n        }\n    }\n\n    /**\n     * Add tag filter expressions. Equivalent to passing tags to the constructor;\n     * additional calls append to the existing tag list (all AND-ed together).\n     *\n     * @param tagExpressions tag expressions like \"@smoke\", \"~@slow\"\n     * @return this builder\n     */\n    public KarateFeatureBuilder tags(String... tagExpressions) {\n        if (tagExpressions != null) {\n            Collections.addAll(tags, tagExpressions);\n        }","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-gatling/src/main/java/io/karatelabs/gatling/KarateFeatureBuilder.java#L54-L90","documentation":"KarateFeatureBuilder wraps a Karate feature file for execution inside a Gatling simulation. The feature path is mandatory; constructing the builder with a null or empty string throws IllegalArgumentException immediately, before any scenario is registered.","triggerScenarios":"new KarateFeatureBuilder(null) or new KarateFeatureBuilder(\"\") — typically because the path comes from an empty system property, env variable, or config constant.","commonSituations":"Reading the feature path from a system property that was never set; refactoring simulations and leaving a placeholder empty string; generating the path programmatically and getting an empty result.","solutions":["Pass a non-empty path, e.g. new KarateFeatureBuilder(\"classpath:features/cats.feature\")","Check the system property / env variable feeding the path has a value before building","Use karate.options or defaults so the path is never built from empty input"],"exampleFix":"// before\nString path = System.getProperty(\"feature\", \"\");\nKarateFeatureBuilder b = new KarateFeatureBuilder(path);\n// after\nString path = System.getProperty(\"feature\", \"classpath:features/cats.feature\");\nif (path == null || path.isEmpty()) throw new IllegalArgumentException(\"feature path not configured\");\nKarateFeatureBuilder b = new KarateFeatureBuilder(path);","handlingStrategy":"validation","validationCode":"String path = System.getProperty(\"feature\", \"\");\nif (path == null || path.isEmpty()) { throw new IllegalArgumentException(\"feature path not configured\"); }","typeGuard":null,"tryCatchPattern":"try {\n  KarateFeatureBuilder b = new KarateFeatureBuilder(path);\n} catch (IllegalArgumentException e) {\n  throw new IllegalStateException(\"Simulation misconfigured: \" + e.getMessage(), e);\n}","preventionTips":["Never build the path from an unset system property without a default","Validate simulation config at startup, before registering scenarios","Use classpath: prefixed paths consistently"],"tags":["gatling","karate","constructor","configuration"],"backgroundTag":"missing-required-argument","analyzedSha":"a22eb90246d958d15a47bf436693d0121ad2812d","analyzedAt":"2026-09-12T09:01:00.220Z","contentChangedAt":"2026-09-12T09:01:00.220Z","schemaVersion":2},"datasetVersion":"2026-09-16T19:17:19.609Z"}