{"record":{"id":"9726e41cb57bb4c3","repo":"apache/pulsar","slug":"metadatastoreconfig-query-parameter-key-must-9726e4","errorCode":null,"errorMessage":"MetadataStoreConfig query parameter '${key}' must be greater than or equal to 0","messagePattern":"MetadataStoreConfig query parameter '(.+?)' must be greater than or equal to 0","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/MetadataStoreConfigQueryParams.java","lineNumber":90,"sourceCode":"    private static Map.Entry<String, BiConsumer<MetadataStoreConfigBuilder, String>> positiveIntParam(\n            String key, BiConsumer<MetadataStoreConfigBuilder, Integer> setter) {\n        return Map.entry(key, (builder, value) -> setter.accept(builder, parsePositiveInt(key, value)));\n    }\n\n    private static boolean parseBoolean(String key, String value) {\n        if (\"true\".equalsIgnoreCase(value)) {\n            return true;\n        } else if (\"false\".equalsIgnoreCase(value)) {\n            return false;\n        }\n        throw new IllegalArgumentException(\"MetadataStoreConfig query parameter '\" + key\n                + \"' must be true or false\");\n    }\n\n    private static int parseNonNegativeInt(String key, String value) {\n        int intValue = parseInt(key, value);\n        if (intValue < 0) {\n            throw new IllegalArgumentException(\"MetadataStoreConfig query parameter '\" + key\n                    + \"' must be greater than or equal to 0\");\n        }\n        return intValue;\n    }\n\n    private static int parsePositiveInt(String key, String value) {\n        int intValue = parseInt(key, value);\n        if (intValue <= 0) {\n            throw new IllegalArgumentException(\"MetadataStoreConfig query parameter '\" + key\n                    + \"' must be greater than 0\");\n        }\n        return intValue;\n    }\n\n    private static int parseInt(String key, String value) {\n        try {\n            return Integer.parseInt(value);\n        } catch (NumberFormatException e) {","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/MetadataStoreConfigQueryParams.java#L72-L108","documentation":"parseNonNegativeInt() parses an integer query-parameter value and rejects negative numbers, throwing IllegalArgumentException 'must be greater than or equal to 0'. Used for parameters like sessionTimeoutMillis where a negative value is meaningless.","triggerScenarios":"nonNegativeIntParam applied to a negative number in the metadata store URL config section, e.g. ?sessionTimeoutMillis=-1.","commonSituations":"Copy-pasted configs with placeholder -1 meaning 'unset'; templating errors substituting negative defaults; confusion about which params accept 0 vs only positive values.","solutions":["Set the value to 0 or a positive integer.","Use the documented default by removing the parameter entirely instead of passing -1.","Fix templating/variable substitution that produced the negative number."],"exampleFix":"// before\n?sessionTimeoutMillis=-1\n// after\n?sessionTimeoutMillis=30000","handlingStrategy":"validation","validationCode":"int v = Integer.parseInt(value);\nif (v < 0) throw new IllegalArgumentException(key + \" must be >= 0\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use 0 or positive integers; omit the param to get defaults","Replace sentinel -1 configs with param removal","Check templates for negative substitution"],"tags":["configuration","validation","integer","metadata-store"],"backgroundTag":"invalid-config-parameter","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}