{"record":{"id":"fbfe9e3f4747fdaf","repo":"apache/seatunnel","slug":"param-s-is-not-set-in-error-message-s","errorCode":null,"errorMessage":"Param [%s] is not set in error message [%s]","messagePattern":"Param \\[(.+?)\\] is not set in error message \\[(.+?)\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-common/src/main/java/org/apache/seatunnel/common/exception/ExceptionParamsUtil.java","lineNumber":64,"sourceCode":"    }\n\n    public static String getDescription(String descriptionTemplate, Map<String, String> params) {\n        assertParamsMatchWithDescription(descriptionTemplate, params);\n        String description = descriptionTemplate;\n        for (String param : getParams(descriptionTemplate)) {\n            String value = params.get(param);\n            description = description.replace(String.format(\"<%s>\", param), value);\n        }\n        return description;\n    }\n\n    public static void assertParamsMatchWithDescription(\n            String descriptionTemplate, Map<String, String> params) {\n        getParams(descriptionTemplate)\n                .forEach(\n                        param -> {\n                            if (!params.containsKey(param)) {\n                                throw new IllegalArgumentException(\n                                        String.format(\n                                                \"Param [%s] is not set in error message [%s]\",\n                                                param, descriptionTemplate));\n                            }\n                        });\n    }\n}\n","sourceCodeStart":46,"sourceCodeEnd":72,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-common/src/main/java/org/apache/seatunnel/common/exception/ExceptionParamsUtil.java#L46-L72","documentation":"SeaTunnelErrorCode descriptions are templates with named placeholders (e.g. {key}). ExceptionParamsUtil.assertParamsMatchWithDescription verifies that every placeholder in the template is present in the supplied params map, throwing IllegalArgumentException if any placeholder is missing — i.e. the error message would render with an unfilled parameter.","triggerScenarios":"Building a SeaTunnelException/SeaTunnelSqlException whose error-code description contains a {param} placeholder that is absent from the params map passed alongside it.","commonSituations":"Adding a new placeholder to an error-code description without updating every throw site; misspelling a param key so it does not match the placeholder; passing an empty map to an error code that requires parameters.","solutions":["Add the missing key to the params map with the intended value","Fix the param key spelling so it matches the placeholder exactly (placeholders are the {name} tokens extracted from the template)","If the param is genuinely unnecessary, edit the error-code description template to remove the placeholder"],"exampleFix":"// before\nthrow new SeaTunnelException(SEATUNNEL_ERROR_0001, Collections.emptyMap()); // missing {table}\n// after\nthrow new SeaTunnelException(SEATUNNEL_ERROR_0001, Collections.singletonMap(\"table\", tableName));","handlingStrategy":"validation","validationCode":"Set<String> required = ExceptionParamsUtil.getParams(descriptionTemplate);\nif (!params.keySet().containsAll(required)) throw new IllegalArgumentException(\"missing: \" + new HashSet<>(required).removeAll(params.keySet()));","typeGuard":null,"tryCatchPattern":"try { return new SeaTunnelException(code, params); } catch (IllegalArgumentException e) { log.error(\"error params incomplete for {}: {}\", code, e.getMessage()); throw e; }","preventionTips":["Keep param maps built from constants shared with the description template","After editing an error-code description, update all throw sites","Add a unit test asserting each error code's template params match its throw sites"],"tags":["error-codes","params","argument-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}