{"record":{"id":"cf81d0cf02cd2e06","repo":"quarkusio/quarkus","slug":"what-must-not-be-null","errorCode":null,"errorMessage":"{what} must not be null","messagePattern":"(.+?) must not be null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-reactive/rest-csrf/runtime/src/main/java/io/quarkus/csrf/reactive/runtime/RestCsrfBuilder.java","lineNumber":150,"sourceCode":"        return this;\n    }\n\n    @Override\n    public CSRF build() {\n        record CSRFImpl(String formFieldName, String tokenHeaderName, String cookieName, Duration cookieMaxAge,\n                String cookiePath, Optional<String> cookieDomain, boolean cookieForceSecure,\n                boolean cookieHttpOnly, Optional<Set<String>> createTokenPath, int tokenSize,\n                Optional<String> tokenSignatureKey, boolean verifyToken,\n                boolean requireFormUrlEncoded) implements RestCsrfConfig, CSRF {\n        }\n        return new CSRFImpl(formFieldName, tokenHeaderName, cookieName, cookieMaxAge, cookiePath, cookieDomain,\n                cookieForceSecure, cookieHttpOnly, createTokenPath, tokenSize, tokenSignatureKey, verifyToken,\n                requireFormUrlEncoded);\n    }\n\n    private static <T> T requireNonNull(T value, String what) {\n        if (value == null) {\n            throw new IllegalArgumentException(what + \" must not be null\");\n        }\n        return value;\n    }\n\n    private static RestCsrfConfig getRestCsrfConfig() {\n        return ConfigProvider.getConfig().unwrap(SmallRyeConfig.class).getConfigMapping(RestCsrfConfig.class);\n    }\n}\n","sourceCodeStart":132,"sourceCodeEnd":159,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-reactive/rest-csrf/runtime/src/main/java/io/quarkus/csrf/reactive/runtime/RestCsrfBuilder.java#L132-L159","documentation":"RestCsrfBuilder.requireNonNull validates mandatory build inputs (form field name, header/cookie names, cookie max-age/path/domain, etc.). A null among these makes the builder throw IllegalArgumentException immediately. This typically means a required config property resolved to null or a null was passed programmatically to the builder.","triggerScenarios":"Programmatic use of RestCsrfBuilder (e.g. in tests or custom setup) passing null for formFieldName/tokenHeaderName/cookieName/cookieMaxAge/cookiePath/cookieDomain; or RestCsrfConfig mapping producing null for a required attribute.","commonSituations":"Overriding quarkus.rest-csrf.* config with null values via profiles/test resources; calling builder methods directly with null; custom config mapping missing defaults.","solutions":["Set all quarkus.rest-csrf.* required properties (form-field-name, cookie-name, cookie-path, etc.) to non-null values in application.properties","In programmatic builder usage, pass explicit defaults (e.g. \"csrf-token\", \"Benign\", \"/\") instead of null","Check profile-specific configs (e.g. %test.) that may null out a property","Inspect the message prefix ({what}) to identify which exact attribute is null"],"exampleFix":"// before\nquarkus.rest-csrf.cookie-path=\n// after\nquarkus.rest-csrf.cookie-path=/","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(cfg.formFieldName(), \"quarkus.rest-csrf.form-field-name must not be null\"); Objects.requireNonNull(cfg.cookieName(), \"quarkus.rest-csrf.cookie-name must not be null\"); Objects.requireNonNull(cfg.cookiePath(), \"quarkus.rest-csrf.cookie-path must not be null\");","typeGuard":null,"tryCatchPattern":"try { RestCsrfConfig cfg = buildRestCsrf(); } catch (IllegalArgumentException e) { LOG.error(\"Missing required quarkus.rest-csrf config: \" + e.getMessage()); throw e; }","preventionTips":["Set explicit values for all quarkus.rest-csrf.* properties","Check %test and other profile configs do not null required properties","Use @ConfigMapping defaults so properties never resolve to null","Read the message prefix to identify the exact missing attribute"],"tags":["csrf","config","null-check","quarkus"],"backgroundTag":"required-config-null","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}