swc-project/swc · error · Error
Expected Declaration value
Error message
Expected Declaration value
What it means
Fired in parse_generic_value when the current token does not map to any known component value production (not a function/color/hash/delim/etc.). The parser cannot build any AST node from this token, so it emits this fallback 'expected declaration value' error at the token's span.
Source
Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:117
if *err.kind() != ErrorKind::Ignore {
self.errors.push(err);
}
locv.children
}
};
return Ok(ComponentValue::SimpleBlock(Box::new(block)));
}
tok!("#") => {
return Ok(ComponentValue::Color(self.parse()?));
}
_ => {}
}
Err(Error::new(span, ErrorKind::Expected("Declaration value")))
}
/// Parse value as <any-value>.
pub(super) fn parse_any_value(&mut self) -> PResult<Vec<TokenAndSpan>> {
let mut tokens = Vec::new();
let mut balance_stack: Vec<Option<char>> = Vec::new();
// The <any-value> production matches any sequence of one or more tokens,
// so long as the sequence ...
loop {
if is!(self, EOF) {
break;
}
match cur!(self) {
// ... <bad-string-token>, <bad-url-token>,
tok!("bad-string") | tok!("bad-url") => {
break;View on GitHub (pinned to 5176682b65)
Solutions
- Replace the offending token with a valid component value (number, dimension, percentage, ident, function, etc.)
- Check for typos or unsupported syntax at the reported position
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:117 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of swc-project/swc@5176682b65 (2026-08-17).
Data as JSON: /api/errors/82695371d991eac4.
Report an issue: GitHub.