influxdata/influxdb · error · syn::Error

` ` is not allowed in a catalog record. Fields may be…

Error message

`{}` is not allowed in a catalog record. Fields may be primitives ({}), `String`, arrays, tuples, `Option`/`Vec` of those, or a wire type declared in `records::types`.

What it means

The catch-all compile-time rejection from the catalog record field-type checker (`unsupported`). A field's type is outside the allowed vocabulary: allowed are primitives, `String`, arrays, tuples, `Option`/`Vec` of allowed types, and wire types declared in `records::types`. Anything else (maps, references, trait objects, boxed types, foreign structs) is rejected because the catalog cannot guarantee a fixed bitcode encoding for it.

Solutions

  1. Rewrite the field using allowed types: primitives, `String`, arrays, tuples, `Option`/`Vec` thereof.
  2. For complex data, declare a wire type in `records::types` and convert to the runtime type in the record's `apply` method.
  3. For a map-like field, use `Vec<(K, V)>` of allowed key/value types instead of a map.

Example fix

// before
#[catalog_record(shape = 0x1)]
struct Foo { map: HashMap<u64, String> }

// after
#[catalog_record(shape = 0x1)]
struct Foo { map: Vec<(u64, String)> }
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check record field types against the allowed vocabulary:
// primitives, String, arrays, tuples, Option/Vec of those, records::types wire types.

Prevention

When it happens

Trigger: Declaring a catalog record field of a disallowed type, e.g. `field: HashMap<K,V>`, `field: &str`, `field: Box<dyn Trait>`, or an arbitrary external struct. Raised by `unsupported` when reached from `check` or `check_path`.

Common situations: A developer tries to store a map, a timestamp type from another crate, a reference, or an enum the macro doesn't recognize directly in a record.

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/e018e506321118fa. Report an issue: GitHub.

Appendix: source

Thrown at influxdb3_catalog_macros/src/types.rs:110

        }
        PathArguments::AngleBracketed(_) | PathArguments::Parenthesized(_) => Err(unsupported(ty)),
    }
}

/// Whether a generic argument is a const *literal*, the only generic argument
/// permitted outside `Option`/`Vec`. See the call site for why.
fn is_const_literal(arg: &GenericArgument) -> bool {
    matches!(
        arg,
        GenericArgument::Const(syn::Expr::Lit(syn::ExprLit {
            lit: syn::Lit::Int(_),
            ..
        }))
    )
}

fn unsupported(ty: &Type) -> syn::Error {
    syn::Error::new(
        ty.span(),
        format!(
            "`{}` is not allowed in a catalog record. Fields may be primitives ({}), `String`, \
             arrays, tuples, `Option`/`Vec` of those, or a wire type declared in \
             `records::types`.",
            render(ty),
            PRIMITIVES.join(", "),
        ),
    )
}

fn render(ty: &Type) -> String {
    use quote::ToTokens;
    ty.to_token_stream().to_string().replace(' ', "")
}

#[cfg(test)]
mod tests {

View on GitHub (pinned to 06200ef96b)