{"record":{"id":"5d7c15a01829895d","repo":"elastic/elasticsearch","slug":"unknown-arguments-for-forbiddenpatterns-rule-mappi","errorCode":null,"errorMessage":"Unknown arguments for ForbiddenPatterns rule mapping: {}","messagePattern":"Unknown arguments for ForbiddenPatterns rule mapping: (.+?)","errorType":"validation","errorClass":"InvalidUserDataException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/ForbiddenPatternsTask.java","lineNumber":195,"sourceCode":"    public Map<String, String> getPatterns() {\n        return Collections.unmodifiableMap(patterns);\n    }\n\n    public void exclude(String... excludes) {\n        filesFilter.exclude(excludes);\n    }\n\n    public void rule(Map<String, String> props) {\n        String name = props.remove(\"name\");\n        if (name == null) {\n            throw new InvalidUserDataException(\"Missing [name] for invalid pattern rule\");\n        }\n        String pattern = props.remove(\"pattern\");\n        if (pattern == null) {\n            throw new InvalidUserDataException(\"Missing [pattern] for invalid pattern rule\");\n        }\n        if (props.isEmpty() == false) {\n            throw new InvalidUserDataException(\"Unknown arguments for ForbiddenPatterns rule mapping: \" + props.keySet().toString());\n        }\n        // TODO: fail if pattern contains a newline, it won't work (currently)\n        patterns.put(name, pattern);\n    }\n\n    @Internal\n    abstract ListProperty<FileTree> getSourceFolders();\n\n    @Internal\n    abstract Property<File> getRootDir();\n\n    @Input\n    @Optional\n    Provider<String> getRootDirPath() {\n        return getRootDir().map(t -> t.toPath().relativize(projectLayout.getProjectDirectory().getAsFile().toPath()).toString());\n    }\n\n}","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/ForbiddenPatternsTask.java#L177-L213","documentation":"Thrown by ForbiddenPatternsTask.rule(Map) after 'name' and 'pattern' have been removed: if the map is not empty there are leftover keys, meaning the caller passed unsupported arguments. The rule DSL accepts exactly 'name' and 'pattern'; anything else is a typo or a misuse.","triggerScenarios":"Calling rule with extra keys, e.g. rule(name: 'x', pattern: 'y', description: 'z') or a misspelled key like 'patterns'.","commonSituations":"Typos (e.g. 'Patterns' instead of 'pattern'); copying a richer rule DSL from another plugin; stale keys left after a refactor.","solutions":["Inspect the reported key set in the message and remove the unsupported entries.","Keep only 'name' and 'pattern' in the rule map.","Re-run to confirm."],"exampleFix":"// before\nrule name: 'no-tabs', pattern: '\\\\t', severity: 'error'\n\n// after\nrule name: 'no-tabs', pattern: '\\\\t'","handlingStrategy":"validation","validationCode":"Set<String> allowed = Set.of(\"name\", \"pattern\");\nSet<String> extra = new HashSet<>(props.keySet()); extra.removeAll(allowed);\nif (!extra.isEmpty()) throw new InvalidUserDataException(\"Unknown keys: \" + extra);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass only 'name' and 'pattern' to rule().","Spell-check keys; case matters.","Review rule blocks when copying from other plugins."],"tags":["gradle","forbidden-patterns","precommit","task-config","validation"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}