{"record":{"id":"2d684c4bdce1fc07","repo":"t8y2/dbx","slug":"request-timeout-ms-must-be-a-positive-integer","errorCode":null,"errorMessage":"request.timeout.ms must be a positive integer","messagePattern":"request\\.timeout\\.ms must be a positive integer","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"agents/drivers/kafka/src/main/java/com/dbx/agent/kafka/KafkaAgent.java","lineNumber":1727,"sourceCode":"                \"Peek message count must be between 1 and \" + MAX_PEEK_MESSAGE_COUNT\n            );\n        }\n        return count;\n    }\n\n    static int peekRequestTimeoutMs(JsonObject conn, Properties props) {\n        Integer connectionTimeout = integerOrNull(conn, \"request_timeout_ms\");\n        if (connectionTimeout != null) {\n            return positiveTimeoutMs(\"request_timeout_ms\", connectionTimeout);\n        }\n        String configuredTimeout = props.getProperty(\n            ConsumerConfig.REQUEST_TIMEOUT_MS_CONFIG,\n            String.valueOf(DEFAULT_REQUEST_TIMEOUT_MS)\n        );\n        try {\n            return positiveTimeoutMs(ConsumerConfig.REQUEST_TIMEOUT_MS_CONFIG, Integer.parseInt(configuredTimeout));\n        } catch (NumberFormatException error) {\n            throw new IllegalArgumentException(\n                ConsumerConfig.REQUEST_TIMEOUT_MS_CONFIG + \" must be a positive integer\", error\n            );\n        }\n    }\n\n    private static int positiveTimeoutMs(String name, int timeoutMs) {\n        if (timeoutMs <= 0) {\n            throw new IllegalArgumentException(name + \" must be a positive integer\");\n        }\n        return timeoutMs;\n    }\n\n    static Properties peekConsumerProperties(JsonObject conn, int count) {\n        Properties props = new Properties();\n        props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers(conn));\n        applyConnectionProperties(conn, props);\n        props.put(ConsumerConfig.GROUP_ID_CONFIG, \"dbx-peek-\" + UUID.randomUUID());\n        props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,","sourceCodeStart":1709,"sourceCodeEnd":1745,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/kafka/src/main/java/com/dbx/agent/kafka/KafkaAgent.java#L1709-L1745","documentation":"KafkaAgent reads the configured request.timeout.ms (falling back to DEFAULT_REQUEST_TIMEOUT_MS) and parses it as an integer. If the configured value is not a valid integer, it wraps the NumberFormatException in this IllegalArgumentException. This fails fast at connection setup instead of producing an opaque Kafka client error later.","triggerScenarios":"Setting request.timeout.ms in the Kafka connection config to a non-integer value such as \"30s\", \"30_000\", \"30,000\", \"\", or a whitespace/full-width-digit string, then opening a connection or performing a peek.","commonSituations":"Config values copied from documentation that use unit suffixes (ms assumed but \"5000ms\" written); env-var substitution leaving a placeholder or empty string; locale-formatted numbers with separators; YAML/JSON config quoting mistakes.","solutions":["Set request.timeout.ms to a plain positive integer of milliseconds, e.g. \"30000\".","If the value comes from an env var or templated config, verify substitution produced digits only (no empty string or placeholder).","Remove unit suffixes/separators; the driver does not parse human-readable durations."],"exampleFix":"// before\nconfig.put(\"request.timeout.ms\", \"30s\");\n\n// after\nconfig.put(\"request.timeout.ms\", \"30000\");","handlingStrategy":"validation","validationCode":"String v = config.getProperty(\"request.timeout.ms\");\nif (v == null || !v.matches(\"\\\\d+\") || Integer.parseInt(v) <= 0) {\n    throw new IllegalArgumentException(\"request.timeout.ms must be a positive integer string like 30000\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    consumer = agent.connect(conn);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"request.timeout.ms\")) {\n        conn.put(\"request.timeout.ms\", \"30000\"); // reset to default and retry\n        consumer = agent.connect(conn);\n    } else throw e;\n}","preventionTips":["Store timeout config as plain millisecond integers, never with unit suffixes","Validate all numeric config values with a regex ^[0-9]+$ at load time","Check env-var substitution output for empty strings or leftover placeholders"],"tags":["kafka","config","number-format"],"backgroundTag":"invalid-config-value","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}