GitoxideLabs/gitoxide · error
Couldn't apply a single conversion - momo is ineffective…
Error message
Couldn't apply a single conversion - momo is ineffective here
What it means
The `momo` proc-macro (used for `impl Into<T>` argument conversion, as in gix's `#[gix::command_fn]`-style wrappers) rewrites a function so each argument is converted once at the boundary. If it finds no argument whose type it actually converts, the macro would rewrite nothing and be 'ineffective', so it emits this compile error to signal misuse.
Solutions
- Remove the attribute macro — it serves no purpose on a function with no convertible arguments.
- Give the function parameters that the macro converts (e.g. `impl Into<String>` instead of `String`).
- Check the macro's supported `Conversion` list in gix-macros/src/momo.rs to see which parameter types qualify.
Example fix
// before: nothing to convert -> compile error
#[momo]
fn open(id: u64) -> Repo { ... }
// after: remove the attribute, or make an argument convertible
fn open(id: u64) -> Repo { ... }
// or
#[momo]
fn open(path: impl Into<PathBuf>) -> Repo { ... } Defensive patterns
Strategy: validation
Prevention
- Only apply momo-based attributes to functions with convertible parameters (e.g. `impl Into<...>`).
- Remove the attribute when the function has no arguments needing conversion.
- Check gix-macros/src/momo.rs `Conversion` enum for supported parameter types.
When it happens
Trigger: Applying the momo-based attribute macro to a function whose parameters use no supported conversion types (`&str`->`String`, `impl Into<...>` patterns it recognizes), so `has_conversion_in_effect` is false.
Common situations: Annotating a function with no arguments or only already-concrete types; adding the macro to a helper by copy-paste; removing a parameter that previously needed conversion without removing the attribute.
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
- expect a function
- ' ' is not a valid configuration key
- Cannot use iter_v1() on index of type
- Cannot use iter_v2() on index of type
- BUG: tries to obtain object id from symbolic target
AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08).
Data as JSON: /api/errors/df782379713d1896.
Report an issue: GitHub.
Appendix: source
Thrown at gix-macros/src/momo.rs:16
use std::collections::HashMap;
use quote::quote;
use syn::{punctuated::Punctuated, spanned::Spanned, *};
pub(crate) fn inner(code: proc_macro2::TokenStream) -> proc_macro2::TokenStream {
let fn_item: Item = match syn::parse2(code.clone()) {
Ok(input) => input,
Err(err) => return err.to_compile_error(),
};
if let Item::Fn(item_fn) = fn_item {
let ty_conversions = parse_generics(&item_fn.sig);
let (has_conversion_in_effect, argtypes, argexprs, has_self) = convert(&item_fn.sig.inputs, &ty_conversions);
if !has_conversion_in_effect {
return Error::new(
item_fn.span(),
"Couldn't apply a single conversion - momo is ineffective here",
)
.to_compile_error();
}
let uses_self = has_self
|| item_fn.sig.inputs.iter().any(has_self_type)
|| matches!(&item_fn.sig.output, ReturnType::Type(_, ty) if contains_self_type(ty));
let inner_ident = Ident::new(
// Use long qualifier to avoid name collision.
&format!("_{}_inner_generated_by_gix_macro_momo", item_fn.sig.ident),
proc_macro2::Span::call_site(),
);
let outer_sig = Signature {
inputs: argtypes,View on GitHub (pinned to e73179060b)