What you describe is already the default. xargs -n provides a maximum number of arguments to use, but if you don't specify it, xargs will use as many arguments as possible.
You mentioned the system limit in your question, and that you don't expect/need to circumvent that. xargs will take that system limit into account, but may use a lower value, as described in the usage for the --max-chars (-s) option:
--max-chars=max-chars
-s max-chars
Use at most max-chars characters per command line, including the command and initial-arguments and the terminating nulls at the ends of the argument strings. The largest allowed
value is system-dependent, and is calculated as the argument length limit for exec, less the
size of your environment, less 2048 bytes of headroom. If this value is more than 128KiB,
128Kib is used as the default value; otherwise, the default value is the maximum. 1KiB is 1024 bytes.
(emphasis mine)
You can check what it is with echo | xargs --show-limits. Example output:
Your environment variables take up 3712 bytes
POSIX upper limit on argument length (this system): 2091392
POSIX smallest allowable upper limit on argument length (all systems): 4096
Maximum length of command we could actually use: 2087680
Size of command buffer we are actually using: 131072
Maximum parallelism (--max-procs must be no greater): 2147483647
This shows that my hard limit is 2087680 (just under 2MiB). If your system also permits more than 128K, you can prevent splitting by using xargs -s 2087680 (adjust according to your own limit).
Older versions of xargs would even let you provide a higher limit than the OS permits. With 4.4.2, a warning was displayed, but the specified value accepted anyway, and you get the same error that you would see from running the command directly:
$ seq 1 2000000 | xargs -s 2100000 echo | wc -l
xargs: value for -s option should be < 2092927
xargs: echo: Argument list too long
0
But in versions 4.6, the hard limit is respected:
$ seq 1 2000000 | xargs -s 2100000 echo | wc -l
xargs: value for -s option should be <= 2091392
23
xargsis that very long lists of arguments simply can't be given to a utility in one go as the argument list has an upper length limit.xargswill by default give as many arguments as possible to the utility. An example of your issue would be good to see (please edit your question).argv.