risingwavelabs/risingwave · error

Unsupported attribute argument, expected a string literal pr

Error message

Unsupported attribute argument, expected a string literal prefix or mode

What it means

Compile-time error from the proc-macro attribute parser parse_args (invoked via try_prefix_all for the serde prefix attribute): a nested attribute argument was given that is neither a string literal prefix nor a recognized `mode = ...` entry. If a mode value was supplied but is not "rename" or "alias", this sentinel fires (also used generically when a non-literal appears where a mode literal is expected). Fix the attribute usage; the macro will not compile otherwise.

Source

Thrown at src/common/proc_macro/src/serde_prefix_all.rs:103

                let parsed_mode = match lit {
                    Lit::Str(lit_str) => match lit_str.value().as_str() {
                        "rename" => Mode::Rename,
                        "alias" => Mode::Alias,
                        _ => {
                            return Err(Error::new(
                                lit_str.span(),
                                "mode must be \"rename\" or \"alias\"",
                            ));
                        }
                    },
                    _ => return Err(Error::new(lit.span(), "mode must be a string literal")),
                };

                mode = Some(parsed_mode);
            }
            NestedMeta::Meta(meta) => {
                return Err(Error::new(
                    meta.span(),
                    "Unsupported attribute argument, expected a string literal prefix or mode",
                ));
            }
        }
    }

    let (prefix, span) =
        prefix.ok_or_else(|| Error::new(Span::call_site(), "Missing prefix string argument"))?;
    Ok(ParsedArgs {
        prefix,
        prefix_span: span,
        mode: mode.unwrap_or(Mode::Rename),
    })
}

pub(crate) fn try_prefix_all(
    args: AttributeArgs,

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Use only supported argument forms: a string literal prefix, e.g. `#[prefix_all("field_")]`, or `mode = "rename"` / `mode = "alias"`
  2. Correct the mode spelling to exactly "rename" or "alias"
  3. Ensure the mode argument is a string literal, not a variable, ident, or other literal type
  4. Remove unsupported nested meta arguments from the attribute
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/common/proc_macro/src/serde_prefix_all.rs:103 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/594ed19e5541dc3c. Report an issue: GitHub.