linera-io/linera-protocol · error
Invalid protocol flag
Error message
Invalid protocol flag
What it means
When assembling a ResourceControlPolicy, the CLI parses each --flags string into the ProtocolFlag enum (strum EnumString) and collects the results into a BTreeSet. The expect panics when any flag string does not match a ProtocolFlag variant. In the current linera-execution the enum only defines the hidden variant _Reserved, so effectively every user-supplied flag value fails.
Source
Thrown at linera-service/src/cli/main.rs:729
.map(|ids| {
ids.into_iter().map(|s| s.parse()).collect::<Result<
BTreeSet<_>,
_,
>>(
)
})
.transpose()
.expect("Invalid application ID")
.unwrap_or(existing_policy.free_application_ids),
flags: flags
.map(|values| {
values
.into_iter()
.map(|s| s.parse())
.collect::<Result<BTreeSet<_>, _>>()
})
.transpose()
.expect("Invalid protocol flag")
.unwrap_or(existing_policy.flags),
};
info!("{policy}");
if committee.policy() == &policy {
return Ok(ClientOutcome::Committed(None));
}
}
_ => unreachable!(),
}
let new_committee = Committee::new(validators, policy)?;
chain_client
.stage_new_committee(new_committee)
.await
.map(|outcome| outcome.map(Some))
}
})
.await
.context("Failed to stage committee")?;View on GitHub (pinned to 6c226ddcb3)
Solutions
- Omit --flags entirely — the field is reserved for future protocol flags and has no user-facing values today
- If a value must be supplied for testing, only the exact variant name '_Reserved' parses on current versions
- Check the ProtocolFlag variants for your linera-execution version (linera-execution/src/policy.rs) before scripting flags
- Remove the flag from templates/CI scripts that were written against a different toolchain
Example fix
# before linera ... --flags experimental # after linera ... # omit --flags; no protocol flags are accepted yet
Defensive patterns
Strategy: validation
Validate before calling
# Only accept flag values known to the installed version (currently none / _Reserved). if [ -n "$FLAGS" ] && [ "$FLAGS" != '_Reserved' ]; then echo "unsupported --flags value" >&2; exit 1; fi
Prevention
- Leave --flags unset in all scripts and templates
- When upgrading Linera, check ProtocolFlag variants for newly accepted values before adopting them
- Treat reserved CLI surface as off-limits in automation
When it happens
Trigger: Passing --flags with any value (e.g. 'foo', 'fast', '0') on a command that builds a policy: none of them map to a defined ProtocolFlag variant, so .parse() returns Err and the expect aborts.
Common situations: Assuming --flags accepts arbitrary feature toggles or future protocol names; carrying over flag values from other blockchains' CLIs; scripting genesis/config generation with a placeholder flag.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Invalid application ID
- expected whitespace after 'query' keyword
- expected an operation name after 'query', e.g. 'query MyQuer
- The input has not matched: {input}
- empty
AI-assisted analysis of linera-io/linera-protocol@6c226ddcb3 (2026-08-22).
Data as JSON: /api/errors/547848aff38ea690.
Report an issue: GitHub.