neondatabase/neon · warning
Unknown placement policy '{s}', try detached,secondary,attac
Error message
Unknown placement policy '{s}', try detached,secondary,attached:<n> What it means
The placement policy parser did not recognize the value at all: it is neither the keyword 'detached' nor 'secondary' and does not start with 'attached:'. This is the catch-all FromStr error for PlacementPolicyArg.
Source
Thrown at control_plane/storcon_cli/src/main.rs:362
impl FromStr for PlacementPolicyArg {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"detached" => Ok(Self(PlacementPolicy::Detached)),
"secondary" => Ok(Self(PlacementPolicy::Secondary)),
_ if s.starts_with("attached:") => {
let mut splitter = s.split(':');
let _prefix = splitter.next().unwrap();
match splitter.next().and_then(|s| s.parse::<usize>().ok()) {
Some(n) => Ok(Self(PlacementPolicy::Attached(n))),
None => Err(anyhow::anyhow!(
"Invalid format '{s}', a valid example is 'attached:1'"
)),
}
}
_ => Err(anyhow::anyhow!(
"Unknown placement policy '{s}', try detached,secondary,attached:<n>"
)),
}
}
}
#[derive(Debug, Clone)]
struct SkSchedulingPolicyArg(SkSchedulingPolicy);
impl FromStr for SkSchedulingPolicyArg {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
SkSchedulingPolicy::from_str(s).map(Self)
}
}
#[derive(Debug, Clone)]View on GitHub (pinned to 8f60b04da4)
Solutions
- Use exactly one of detached, secondary, or attached:<n>
- Check for stray whitespace or quotes around the argument
- Consult --help for the accepted policy syntax
Example fix
# before --placement-policy attach:1 # after --placement-policy attached:1
Defensive patterns
Strategy: type-guard
Validate before calling
let arg = arg.trim();
if !matches!(arg, "detached" | "secondary") && !arg.starts_with("attached:") {
eprintln!("unknown policy '{arg}'; try detached, secondary, attached:<n>");
} Type guard
fn is_known_placement_policy(s: &str) -> bool {
matches!(s, "detached" | "secondary") || s.starts_with("attached:")
} Prevention
- Trim whitespace and match exact casing before passing the flag
- Quote CLI arguments in scripts
- Re-check --help when the CLI vocabulary changes between versions
When it happens
Trigger: Typos, casing, or whitespace deviations: attach:1, Detached, ' detached' (leading space from quoting), detached-standby, or an empty string.
Common situations: Shell quoting mistakes adding whitespace, stale flag vocabulary from older CLI versions, autocomplete typos.
Related errors
- Invalid format '{s}', a valid example is 'attached:1'
- Unknown scheduling policy '{s}', try active,essential,pause,
- Unknown availability state '{s}'
- setting scheduling policy unsuccessful for safekeeper {node_
- Supply either config file path or --config=inline-config
AI-assisted analysis of neondatabase/neon@8f60b04da4 (2026-08-16).
Data as JSON: /api/errors/1bff4611b7413c05.
Report an issue: GitHub.