unslothai/unsloth · error · ValueError
llama-server does not read an attached value: write '{flag}'
Error message
llama-server does not read an attached value: write '{flag}' and '{value[:32]}' as two separate arguments, not '{token[:64]}' What it means
ValueError from llama_server_args.py:315 — a flag token uses GNU '--flag=value' spelling. llama.cpp looks the WHOLE token up in its option map (folding only underscores), so '--top-k=20' is an argument it has never heard of, not --top-k with a value: measured on b10342/b10360, --top-k=20, --ctx-size=4096 and --flash-attn=on each exit 'invalid argument'. Accepting it meant the model switch tore down the resident model and the child then refused to start, so it is refused while it is still a 400. The module will not split it for you because for switches the 'value' is not one, and it cannot know an ordinary flag's arity.
Source
Thrown at studio/backend/core/inference/llama_server_args.py:315
# naming a flag that looks correct in the log. Only flag-shaped tokens:
# a VALUE may legitimately end in whitespace, a chat template or a
# grammar being the obvious ones.
raise ValueError(
f"llama-server does not accept the spaces around '{token[:64]}': "
f"write it as '{flag}'"
)
elif "=" in token:
# llama.cpp looks the WHOLE token up in its option map, folding only the
# underscore spelling, so "--top-k=20" is not "--top-k" with a value: it
# is an argument it has never heard of. Measured on b10342 and b10360,
# where --top-k=20, --ctx-size=4096 and --flash-attn=on each exit with
# "error: invalid argument". Accepting the GNU spelling here meant the
# switch tore down the resident model and the child then refused to
# start, so it is refused while it is still a 400 with somewhere to go.
# Splitting it here would be a guess: for a switch the value is not one,
# and this module cannot know an ordinary flag's arity.
value = token.partition("=")[2]
raise ValueError(
f"llama-server does not read an attached value: write '{flag}' and "
f"'{value[:32]}' as two separate arguments, not '{token[:64]}'"
)
else:
# Its own value when attached, otherwise the tokens that follow.
attached = _value_is_attached(token, flag)
if pending_two_value > 0:
raise ValueError(f"llama-server flag '{two_value_flag}' takes two values")
# An attached value is ONE of the two, not the whole option:
# "--control-vector-layer-range=1" still owes its END, and
# llama-server exits on the incomplete option.
if flag in _TWO_VALUE_FLAGS:
pending_values = 1 if attached else 2
pending_two_value = pending_values
elif flag in _OPTIONAL_SECOND_VALUE_FLAGS:
# Allowed, not owed: pending_two_value stays 0, so nothing here
# insists on the second token.
pending_values = 1 if attached else 2View on GitHub (pinned to 203007d190)
Solutions
- Rewrite as two tokens: '--ctx-size 4096' instead of '--ctx-size=4096' (the error message names the exact split).
- If building args programmatically from a dict, emit flag and value as separate list elements.
- Grep your stored config for '=' inside tokens starting with '-' and split them at load time — except _TWO_VALUE_FLAGS and _OPTIONAL_SECOND_VALUE_FLAGS where attached handling differs, letting the validator sort it out is safer.
Example fix
# before extra_args = ["--ctx-size=4096", "--flash-attn=on"] # after extra_args = ["--ctx-size", "4096", "--flash-attn", "on"]
Defensive patterns
Strategy: validation
Validate before calling
extra_args = [
part
for tok in raw_args
for part in ((tok.split('=', 1) if tok.startswith('--') and '=' in tok else [tok]))
] Type guard
def no_attached_values(tokens) -> bool:
return not any(t.startswith('-') and '=' in t for t in tokens) Try / catch
try:
validate_extra_args(args)
except ValueError as e:
if "attached value" in str(e):
raise HTTPException(400, "write flags and values as separate tokens")
raise Prevention
- Default to space-separated flag/value pairs; llama.cpp does not parse '--flag=value'.
- Emit args from a dict as alternating [flag, value] elements.
- Lint stored configs for tokens matching ^--.*=.
- Remember this validator refuses rather than splits — do the split yourself.
When it happens
Trigger: Passing any '--flag=value' token in extra args: --ctx-size=4096, --top-k=20, --flash-attn=on, --split-mode=row. Every attached-value spelling of a known flag hits this branch.
Common situations: Muscle memory from GNU tools; copy-pasting from llama.cpp docs or blog posts that use '='; config generators emitting key=value style.
Related errors
- extra llama-server args cannot contain a bare value ('{token
- llama-server does not accept the spaces around '{token[:64]}
- llama-server flag '{two_value_flag}' takes two values
- too many extra llama-server args (limit {MAX_EXTRA_ARG_TOKEN
- extra llama-server args are too large (limit {limit} bytes)
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/4ee3820f63259d7b.
Report an issue: GitHub.