BUG: ValueError crash in _parse_prefixed_args when argument value contains '='
What breaks
_parse_prefixed_args() in src/promptflow-parallel/promptflow/parallel/_config/parser.py (line 88) crashes with ValueError: too many values to unpack (expected 2) whenever an argument value contains the = character. This affects common real-world inputs: base64-encoded values (which use = as padding), URLs with query strings, and any JSON/key-value pairs embedded in an argument value.
Minimal repro:
from promptflow.parallel._config.parser import _parse_prefixed_args
# Base64 "Hello World" ends with '=' padding — this crashes:
_parse_prefixed_args(["--pf_input_token=SGVsbG8gV29ybGQ="], "--pf_input_")
# ValueError: too many values to unpack (expected 2)
Traceback:
File "parser.py", line 88, in _parse_prefixed_args
arg_name, arg_value = arg.split("=")
ValueError: too many values to unpack (expected 2)
Root cause
arg.split("=") with no maxsplit produces more than 2 elements when the value contains =. The fix is arg.split("=", 1) so only the first = is treated as the name/value delimiter and the remainder of the string is preserved as the value.
Hi, we're sending this friendly reminder because we haven't heard back from you in 30 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 7 days of this comment, the issue will be automatically closed. Thank you!
yeah i hit this exact thing a while back, super annoying. the root's definitely just the missing maxsplit on arg.split in _parse_prefixed_args, if you swap that to arg.split("=", 1), it'll grab the first = for the key and keep the rest as the value. otherwise anything with padding or a url gets nuked. honestly, surprised this didn't pop up earlier since base64 and secrets with = are everywhere.
the thing is, changing this shouldn't break any existing calls unless stuff relied on the old broken split (which would be weird). i've patched this locally by just editing line 88 in parser.py, works fine for both single = and crazy long values with a bunch of = signs inside.
out of curiosity, are you using custom prefixes or just the --pf_input_ stuff? i had to deal with some awkward arg parsing when mixing different prefix patterns and it got messy.
Thanks @rehan243 — glad it's not just me hitting it. Same root cause you landed on: the split in _parse_prefixed_args has no maxsplit, so any value containing an = (base64, URLs, connection strings, secrets) either gets truncated or blows up on the tuple unpack.
I've already opened #4175 for this — it's the exact split('=', 1) change in parser.py plus a regression test covering single-=, multiple-=, and empty-value cases, and it's linked to this issue. Would be great to have your eyes on it since you've hit this in the wild.
To your question: just the standard --pf_input_ prefix, no custom ones — the trigger was purely a value containing =, not the prefix pattern itself. I didn't touch the mixed-prefix parsing you mentioned; that sounds like a separate sharp edge and probably worth its own issue if you can repro it.
fwiw, I hit this exact ValueError in a different pipeline where I was passing base64 tokens, so yeah, it's a classic gotcha. The thing is, arg.split("=") grabs every '=' in the string, so anything like 'SGVsbG8gV29ybGQ=' just blows up with the "too many values to unpack" error you mentioned. Switching to split("=", 1) fixed it for me, keeps the value intact even if it's loaded with equals signs. Honestly, took me a few tries to spot that's what was happening since the docs don't mention the '=' edge case at all.
I didn't need to touch anything else in parser.py, just changed that arg_name, arg_value line. Been running fine since, even with URLs stuffed in args. Out of curiosity, are you on the latest promptflow-parallel? I was on v1.3 when this hit, so wondering if it's still an issue in v2.x or if you're seeing it with funky argument values?
Hi, we're sending this friendly reminder because we haven't heard back from you in 30 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 7 days of this comment, the issue will be automatically closed. Thank you!