{"record":{"id":"b7c64ee1272bb58e","repo":"cube-js/cube","slug":"unknown-native-bridge-flag-expected-without-impo","errorCode":null,"errorMessage":"unknown native_bridge flag (expected `without_imports` or `with_static_meta`)","messagePattern":"unknown native_bridge flag \\(expected `without_imports` or `with_static_meta`\\)","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"rust/cube/cubesqlplanner/nativebridge/src/lib.rs","lineNumber":25,"sourceCode":"use syn::token::PathSep;\nuse syn::LitStr;\nuse syn::{\n    parse_macro_input, punctuated::Punctuated, Data, DeriveInput, Fields, FnArg, Item, Meta, Pat,\n    Path, PathArguments, PathSegment, ReturnType, TraitItem, TraitItemFn, Type,\n};\n#[proc_macro_attribute]\npub fn native_bridge(args: TokenStream, input: TokenStream) -> proc_macro::TokenStream {\n    let mut svc = parse_macro_input!(input as NativeService);\n    let args = parse_macro_input!(args with Punctuated::<Meta, syn::Token![,]>::parse_terminated);\n    for arg in args.iter() {\n        match arg {\n            Meta::Path(p) => {\n                if p.is_ident(\"without_imports\") {\n                    svc.without_imports = true;\n                } else if p.is_ident(\"with_static_meta\") {\n                    svc.with_static_meta = true;\n                } else if looks_like_flag(p) {\n                    return syn::Error::new(\n                        p.span(),\n                        \"unknown native_bridge flag (expected `without_imports` or `with_static_meta`)\",\n                    )\n                    .to_compile_error()\n                    .into();\n                } else {\n                    svc.static_data_type = Some(p.clone())\n                }\n            }\n            _ => {}\n        }\n    }\n\n    proc_macro::TokenStream::from(svc.into_token_stream())\n}\n\nfn looks_like_flag(path: &Path) -> bool {\n    if path.segments.len() != 1 {","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cube/cubesqlplanner/nativebridge/src/lib.rs#L7-L43","documentation":"The #[native_bridge] attribute macro only accepts two helper flags: `without_imports` and `with_static_meta`. When a flag-like attribute argument (looks_like_flag) is present but matches neither known name, the macro bails out and emits this compile error so the developer knows the attribute is misspelled or unsupported.","triggerScenarios":"Annotating a trait with #[native_bridge(...)] and passing an unrecognized flag such as #[native_bridge(without_import)], #[native_bridge(With_Static_Meta)], #[native_bridge(no_imports)], or any typo/renamed flag inside the parentheses.","commonSituations":"Typos or singular/plural mistakes when copying examples, renaming of flags across crate versions, or inventing a flag assuming the macro supports it (e.g. trying to disable imports with a different name).","solutions":["Replace the unknown flag with `without_imports` or `with_static_meta` exactly as spelled (lowercase snake_case).","If the intent was to skip generated imports, use `#[native_bridge(without_imports)]`.","If the intent was to embed static metadata, use `#[native_bridge(with_static_meta)]`.","Check the nativebridge crate version in Cargo.toml and its docs — the set of supported flags may differ between versions."],"exampleFix":"// before\n#[native_bridge(without_import)]\ntrait MyService { }\n\n// after\n#[native_bridge(without_imports)]\ntrait MyService { }","handlingStrategy":"validation","validationCode":"// Check attribute flags before compiling\nconst ALLOWED: [&str; 2] = [\"without_imports\", \"with_static_meta\"];\nfn valid_flags(attrs: &[&str]) -> bool {\n    attrs.iter().all(|a| ALLOWED.contains(a))\n}\n// usage: assert!(valid_flags(&[\"without_imports\"]));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy flag names directly from the nativebridge docs or lib.rs source","Enable rust-analyzer inline errors so the macro error surfaces immediately","Grep the crate for `is_ident(` to list all accepted flags for your version"],"tags":["proc-macro","compile-time","rust","attribute-macro"],"backgroundTag":"invalid-attribute-argument","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}