{"record":{"id":"dfdfc65455670626","repo":"signalapp/Signal-Server","slug":"target-queue-size-bytes-must-be-positive","errorCode":null,"errorMessage":"target-queue-size-bytes must be positive","messagePattern":"target-queue-size-bytes must be positive","errorType":"console","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"service/src/main/java/org/whispersystems/textsecuregcm/workers/TrimOversizedFoundationDbMessageQueuesCommand.java","lineNumber":108,"sourceCode":"        .type(Long.class)\n        .dest(RANGE_SPLIT_CHUNK_SIZE_BYTES_ARGUMENT)\n        .required(false)\n        .setDefault(DEFAULT_RANGE_SPLIT_CHUNK_SIZE_BYTES)\n        .help(\"\"\"\n            The chunk size to use when determining split points for the range of keys covered by a message queue.\n            FoundationDB does not provide any documentation on this parameter, but observationally,\n            setting this value greater than 1 MB should be okay.\n            \"\"\");\n  }\n\n  @Override\n  protected void crawlAccounts(final Flux<Account> accounts) {\n    final long maxQueueSizeBytes = getNamespace().getLong(MAX_QUEUE_SIZE_BYTES_ARGUMENT);\n    final long targetQueueSizeBytes = getNamespace().getLong(TARGET_QUEUE_SIZE_BYTES_ARGUMENT);\n    final long rangeSplitChunkSizeBytes = getNamespace().getLong(RANGE_SPLIT_CHUNK_SIZE_BYTES_ARGUMENT);\n\n    if (targetQueueSizeBytes <= 0) {\n      throw new IllegalArgumentException(\"target-queue-size-bytes must be positive\");\n    }\n\n    if (targetQueueSizeBytes >= maxQueueSizeBytes) {\n      throw new IllegalArgumentException(\"target-queue-size-bytes must be less than max-queue-size-bytes\");\n    }\n\n    if (rangeSplitChunkSizeBytes <= 0) {\n      throw new IllegalArgumentException(\"range-split-chunk-size-bytes must be positive\");\n    }\n\n    final boolean dryRun = getNamespace().getBoolean(DRY_RUN_ARGUMENT);\n    final int maxConcurrency = getNamespace().getInt(MAX_CONCURRENCY_ARGUMENT);\n\n    final MessagesManager messagesManager = getCommandDependencies().messagesManager();\n\n    accounts\n        .flatMapIterable(account ->\n            account.getDevices().stream().map(","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/signalapp/Signal-Server/blob/100ab61c82627582c867d19e1c0561ba2781e927/service/src/main/java/org/whispersystems/textsecuregcm/workers/TrimOversizedFoundationDbMessageQueuesCommand.java#L90-L126","documentation":"TrimOversizedFoundationDbMessageQueuesCommand validates its tuning arguments at the start of crawlAccounts. target-queue-size-bytes is the byte threshold the trimmer shrinks queues toward; a zero or negative value is nonsensical, so an IllegalArgumentException is thrown before any accounts are processed.","triggerScenarios":"Running the `trim-oversized-foundation-db-message-queues` command with --target-queue-size-bytes of 0 or a negative number.","commonSituations":"Shell variable interpolation failing so the flag expands to 0/empty; copying an example command and leaving a placeholder value; unit confusion (passing a percentage instead of a byte count).","solutions":["Pass a positive byte value, e.g. --target-queue-size-bytes 100000","Check the script/env that supplies the value resolves to a real positive number","Remember target must also be strictly less than --max-queue-size-bytes"],"exampleFix":"// before\n--target-queue-size-bytes 0\n// after\n--target-queue-size-bytes 100000","handlingStrategy":"validation","validationCode":"long target = Long.parseLong(args[\"target-queue-size-bytes\"]);\nif (target <= 0) throw new IllegalArgumentException(\"target-queue-size-bytes must be positive\");","typeGuard":null,"tryCatchPattern":"try { crawlAccounts(accounts); } catch (IllegalArgumentException e) { System.err.println(\"config: \" + e.getMessage()); System.exit(2); }","preventionTips":["Always pass explicit positive byte values","Check shell variables resolve before running","Validate the full flag set (target < max) in scripts"],"tags":["cli","validation","configuration"],"backgroundTag":"invalid-argument-value","analyzedSha":"100ab61c82627582c867d19e1c0561ba2781e927","analyzedAt":"2026-09-09T13:29:47.883Z","contentChangedAt":"2026-09-09T13:29:47.883Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}