influxdata/influxdb · error · syn::Error

`shape` must be an integer literal, e.g. `shape =…

Error message

`shape` must be an integer literal, e.g. `shape = 0xbba17476`

What it means

The `shape` argument must be an integer literal (the macro reads it at compile time to compare against a computed checksum-like value). Passing any other expression — a variable, const path, string, or arithmetic — fails the ExprLit/Lit::Int pattern and raises this error.

Solutions

  1. Replace the value with a plain integer literal, e.g. `shape = 0xbba17476`
  2. Remove variable/const references — inline the numeric value
  3. Build with a placeholder literal; the compiler output tells you the expected value, then paste it in

Example fix

// before
#[catalog(id = record_ids::X, shape = my_shape_const)]
// after
#[catalog(id = record_ids::X, shape = 0xbba17476)]
Defensive patterns

Strategy: validation

Validate before calling

// shape must be a bare integer literal:
// bad:  shape = MY_CONST, shape = "0x1", shape = 0x1u64
// good: shape = 0xbba17476

Prevention

When it happens

Trigger: Writing `shape = MY_SHAPE`, `shape = 0xbba17476u64`, `shape = "0xbba17476"`, or `shape = some_fn()` instead of a bare integer literal like `shape = 0xbba17476`.

Common situations: Trying to reference a constant from another crate (the macro only sees a literal); copy-pasting a shape into a string; adding a type suffix that makes it a non-plain literal in older syn versions.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/bc3a37cdfa9fa2f0. Report an issue: GitHub.

Appendix: source

Thrown at influxdb3_catalog_macros/src/lib.rs:104

                .path
                .get_ident()
                .ok_or_else(|| syn::Error::new(nv.path.span(), "expected an argument name"))?
                .to_string();

            match key.as_str() {
                "id" => {
                    if id.replace(nv.value).is_some() {
                        return Err(syn::Error::new(nv.path.span(), "duplicate `id`"));
                    }
                }
                "shape" => {
                    let span = nv.value.span();
                    let Expr::Lit(syn::ExprLit {
                        lit: syn::Lit::Int(lit),
                        ..
                    }) = nv.value
                    else {
                        return Err(syn::Error::new(
                            span,
                            "`shape` must be an integer literal, e.g. `shape = 0xbba17476`",
                        ));
                    };
                    if shape.replace(lit).is_some() {
                        return Err(syn::Error::new(nv.path.span(), "duplicate `shape`"));
                    }
                }
                "flags" => {
                    if flags.replace(nv.value).is_some() {
                        return Err(syn::Error::new(nv.path.span(), "duplicate `flags`"));
                    }
                }
                other => {
                    return Err(syn::Error::new(
                        nv.path.span(),
                        format!(
                            "unknown argument `{other}`; supported arguments are `id`, `shape`, `flags`"

View on GitHub (pinned to 06200ef96b)