shadowsocks/shadowsocks-rust · error
`password` is required
Error message
`password` is required
What it means
Thrown when parsing a SIP008/JSON server entry: a `method` is present but the `password` field is missing. Per the code, an absent password is only allowed when no method is set (empty method implies empty password); otherwise ErrorKind::MissingField is returned naming the required method.
Source
Thrown at crates/shadowsocks-service/src/config.rs:2168
Ok(m) => m,
Err(..) => {
let err = Error::new(
ErrorKind::Invalid,
"unsupported method",
Some(format!("`{m}` is not a supported method")),
);
return Err(err);
}
};
// Only "password" support getting from environment variable.
let password = match pwd_opt {
Some(ref pwd) => read_variable_field_value(pwd),
None => {
if method.is_none() {
String::new().into()
} else {
let err = Error::new(
ErrorKind::MissingField,
"`password` is required",
Some(format!("`password` is required for method {method}")),
);
return Err(err);
}
}
};
let mut nsvr = match ServerConfig::new(addr, password, method) {
Ok(svr) => svr,
Err(serr) => {
let err = Error::new(
ErrorKind::Malformed,
"server config create failed",
Some(format!("{}", serr)),
);
return Err(err);View on GitHub (pinned to 8eb0f0a65b)
Solutions
- Add a `password` field to the server entry
- If the server truly has no auth, remove the `method` field entirely (then empty password is allowed)
- Check the upstream SIP008 provider for an updated document with passwords filled in
Example fix
// before
{"server": "1.2.3.4", "server_port": 8388, "method": "aes-256-gcm"}
// after
{"server": "1.2.3.4", "server_port": 8388, "method": "aes-256-gcm", "password": "secret"} Defensive patterns
Strategy: validation
Validate before calling
// before load, for each server object:
if obj.get("method").is_some() && obj.get("password").is_none() {
return Err("password is required when method is set");
} Try / catch
match Config::load_from_json(...) { Err(e) if format!("{e}").contains("password") => fill_passwords_and_retry(), ... } Prevention
- Validate SIP008 JSON against the official schema (which requires password)
- Keep passwords in env/secret stores and inject before loading
- Never strip password fields when trimming configs
When it happens
Trigger: Config parsing of a server object that sets `method` (e.g. `aes-256-gcm`) but omits `password`, or sets it to null.
Common situations: SIP008 JSON from a provider missing per-server passwords; hand-trimmed config files where the password line was deleted; templates with placeholder passwords removed but method kept.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- missing `local_dns_addr` or `remote_dns_addr` in configurati
- missing `forward_addr` in configuration
- missing `local_port`
- invalid online config version
- unsupported method
AI-assisted analysis of shadowsocks/shadowsocks-rust@8eb0f0a65b (2026-09-09).
Data as JSON: /api/errors/ba6e7356df7a83f1.
Report an issue: GitHub.