rust Errors
120 error patterns
Future not Send due to non-Send type
future cannot be sent between threads safely.*Send
- •Use Arc<Mutex<T>> instead of Rc<RefCell<T>>
- •Add Send bound or spawn_local for !Send futures
Future requires Unpin but type doesn't implement it
cannot be unpinned.*Unpin.*is not implemented
- •Use Box::pin() to pin the future on heap
- •Use pin_mut! macro for stack pinning
Type doesn't implement Future trait
the trait.*Future.*is not implemented for
- •Ensure async fn returns impl Future
- •Use .await on async calls
Nested Tokio runtime creation
Cannot start a runtime from within a runtime
- •Use tokio::task::spawn_blocking for sync code
- •Use Handle::current().block_on() in nested context
No Tokio reactor running
there is no reactor running|must be called from.*tokio runtime
- •Add #[tokio::main] or #[tokio::test]
- •Create runtime with Runtime::new()
Tokio blocking thread pool exhausted
reached the configured maximum number of blocking threads
- •Increase max_blocking_threads in RuntimeBuilder
- •Use spawn_blocking sparingly
Serde unknown field in input
serde.*unknown field `.*`, expected one of
- •Add #[serde(deny_unknown_fields)] intentionally or remove it
- •Add missing field to struct
Serde type mismatch during deserialization
serde.*invalid type: .*, expected
- •Add #[serde(deserialize_with)] custom deserializer
- •Fix source data type to match struct
Serde missing required field
serde.*missing field `.*`
- •Add #[serde(default)] for optional fields
- •Use Option<T> for nullable fields
Serde internally tagged enum deserialization failure
serde.*enum.*internally tagged.*cannot deserialize
- •Verify tag field matches #[serde(tag)] value
- •Use #[serde(untagged)] or adjacently tagged
Serde flatten conflicts with deny_unknown_fields
serde.*flatten.*cannot.*with.*deny_unknown_fields
- •Remove deny_unknown_fields when using flatten
- •Use manual Deserialize impl
Method exists but trait bounds not met
the method.*exists for.*but its trait bounds were not satisfied
- •Add required trait bounds to generic parameters
- •Import the trait with use statement
Move out of shared reference
cannot move out of.*which is behind a shared reference
- •Use .clone() if type is Clone
- •Use std::mem::take or std::mem::replace
Closure borrows value that may be dropped
closure may outlive the current function.*borrowed value
- •Add move keyword to closure
- •Clone the value before closure
Closure implements FnOnce but Fn required
expected a closure that implements the.*Fn.*trait.*but this closure only implements.*FnOnce
- •Avoid moving/consuming captured values in closure
- •Clone values instead of moving
Simultaneous mutable and immutable borrow
cannot borrow.*as mutable.*also borrowed as immutable
- •Restructure to separate borrow scopes
- •Clone data to avoid shared reference
Trait not object-safe for dyn dispatch
the trait.*cannot be made into an object
- •Remove generic methods or add where Self: Sized
- •Use enum dispatch instead of trait objects
Unsized trait object usage
the size for values of type.*dyn.*cannot be known at compilation time
- •Use Box<dyn Trait> for owned trait objects
- •Use &dyn Trait for borrowed references
Proc macro panicked during expansion
proc-macro.*panicked.*TokenStream
- •Use syn::Error::to_compile_error instead of panic
- •Validate input tokens before processing
Macro not found in scope
cannot find macro.*in this scope
- •Add #[macro_use] on extern crate or use macro_rules
- •Import with use crate::macro_name
Macro recursion limit exceeded
recursion limit reached while expanding.*macro
- •Add #![recursion_limit = "256"]
- •Restructure macro to reduce recursion depth
Proc macro attribute not found
proc macro.*attribute.*not found
- •Add proc-macro crate to dependencies
- •Import derive/attribute macro correctly
Raw pointer dereference outside unsafe
dereferencing a raw pointer is unsafe
- •Wrap in unsafe block with safety comment
- •Use safe alternative (reference, smart pointer)
Unsafe function called without unsafe block
cannot call unsafe function.*without.*unsafe
- •Wrap call in unsafe { } block
- •Add safety documentation comment
FFI linker symbol not found
undefined reference to|ld: symbol.*not found.*ffi
- •Link correct library with #[link(name = "...")]
- •Add cargo:rustc-link-lib in build.rs
Mutable reference aliasing UB
mutable reference.*aliases.*undefined behavior
- •Use UnsafeCell for interior mutability
- •Ensure no aliasing of &mut references
Cargo workspace path dependency resolution failure
failed to resolve.*use of undeclared.*in workspace
- •Verify path in workspace Cargo.toml members
- •Use relative path in [dependencies]
Cargo feature unification conflict
feature.*was found in.*but is not requested
- •Enable required feature in dependent crate
- •Use default-features = false to avoid conflicts
Cargo linker not found or failed
linker.*not found|error: linker.*cc.*failed
- •Install build-essential/gcc for target
- •Set CARGO_TARGET_*_LINKER env variable
Format string argument mismatch
there is no argument named.*in format string
- •Match named arguments to format placeholders
- •Use positional {} or named {name} consistently
Axum request body already consumed
Axum.*Cannot.*extract.*body.*already consumed
- •Move body extractor to last position in handler
- •Use only one body extractor per handler
Axum handler extractor count mismatch
Axum.*wrong number of extractors.*handler
- •Ensure handler signature matches route extractors
- •Group extractors in tuple or custom struct
Axum extension/state not found
Extension of type.*was not found.*axum
- •Add .with_state() when building router
- •Use Extension<T> or State<T> extractor
Axum middleware service not Clone
axum.*middleware.*Service.*does not implement Clone
- •Wrap state in Arc for clonability
- •Implement Clone for middleware state
Actix-web app data not configured
actix.*App data is not configured.*Data<.*>
- •Add .app_data(Data::new(state)) to App
- •Register state before routes that use it
Actix extractor failure
actix.*Can not extract.*from request
- •Configure extractor limits (JsonConfig, FormConfig)
- •Verify Content-Type header matches extractor
Tower layer doesn't implement Service
tower.*Layer.*does not implement.*Service
- •Implement Service<Request> for the layer
- •Use tower::service_fn for simple transforms
Lifetime too short for closure capture
lifetime.*does not live long enough.*closure
- •Use 'static bound with move closure
- •Clone or Arc-wrap the reference
Type doesn't satisfy lifetime bound
the type.*does not fulfill.*required lifetime.*bound
- •Add appropriate lifetime bounds to generic
- •Use 'static if ownership is transferred
Move of non-Copy type
move occurs because.*has type.*which does not implement.*Copy
- •Implement Clone and call .clone()
- •Use reference instead of move
Serde duplicate field in input
serde.*duplicate field
- •Enable #[serde(deny_unknown_fields)]
- •Use #[serde(rename)] to avoid collisions
Declarative macro token mismatch
no rules expected the token
- •Fix macro invocation syntax
- •Add token pattern to macro_rules! arm
Macro ambiguity multiple matches
local ambiguity.*multiple.*macro.*matches
- •Reorder macro arms from specific to general
- •Add distinguishing tokens between arms
Proc-macro attribute parse failure
custom attribute panicked.*parse.*failed
- •Use syn::parse_macro_input! for robust parsing
- •Handle parse errors gracefully with compile_error!
Non-Send type held across .await
async fn.*is not.*Send.*because.*held across.*await
- •Drop non-Send value before .await point
- •Use Send-compatible alternatives (Mutex vs RefCell)
MutexGuard held across await makes future !Send
future.*is not.*Send.*MutexGuard
- •Drop MutexGuard before .await
- •Use tokio::sync::Mutex instead of std::sync::Mutex
Returning reference to temporary
cannot return value referencing.*temporary value
- •Return owned value instead of reference
- •Store temporary in let binding
Sized method called on trait object
trait.*has.*method.*with a.*where Self: Sized.*cannot be called on.*dyn
- •Remove where Self: Sized from method
- •Use enum dispatch for Sized-requiring methods
Ambiguous method from multiple traits
multiple applicable items in scope.*method
- •Use fully qualified syntax: <T as Trait>::method()
- •Rename conflicting methods
Missing Deserialize impl for type
the trait bound.*Deserialize.*is not satisfied
- •Add #[derive(Deserialize)] to type
- •Implement custom Deserialize with impl
Serde untagged enum no variant matched
serde.*data did not match any variant
- •Verify data matches at least one variant
- •Add fallback variant with #[serde(other)]
Type cycle detection error
cycle detected when.*type_of
- •Break cycle with Box<T> for recursive types
- •Use indirection through trait object
Type inference failure needs turbofish
cannot infer type for type parameter.*turbofish
- •Add ::<Type> turbofish annotation
- •Add explicit type to let binding
Cannot move out of indexed content
error\[E0507\].*cannot move out of.*index
- •Use .remove() to take ownership from Vec
- •Use std::mem::replace with default
Method not found for type
no method named.*found for.*in the current scope
- •Import the trait that provides the method
- •Check method visibility (pub/crate)
Async type mismatch - missing .await
mismatched types.*expected.*found.*async
- •Add .await to resolve the future
- •Change return type to impl Future<Output=T>
Missing lifetime on struct holding reference
consider adding.*lifetime.*to type.*so that.*reference.*tied to it
- •Add lifetime parameter to struct definition
- •Use owned type instead of reference
Impl not general enough for HRTB
implementation of.*is not general enough
- •Use for<'a> higher-ranked trait bound
- •Widen lifetime bound to satisfy all cases
Async trait method not Send
async.*trait.*Send.*not satisfied
- •Use #[async_trait] from async-trait crate
- •Return Pin<Box<dyn Future + Send>>
Value used after move
value used here after move
- •Clone value before first use
- •Restructure to avoid reuse after move
Cargo workspace member not found
workspace.*member.*not found
- •Verify path in [workspace] members array
- •Check directory exists at specified path
Cargo version resolution failure
failed to select a version for.*required by
- •Update dependency version constraints
- •Use cargo update -p <package>
Cargo feature not enabled
feature.*requires.*but.*not enabled
- •Enable feature in Cargo.toml dependency
- •Use features = ["feature-name"]
Axum type doesn't implement IntoResponse
axum.*IntoResponse.*not implemented
- •Implement IntoResponse for custom type
- •Return (StatusCode, impl IntoResponse) tuple
Axum handler trait not satisfied
axum.*Handler.*does not implement
- •Ensure handler is async and returns IntoResponse
- •Check extractor types implement FromRequest
Tokio spawned task panicked
tokio.*task.*JoinError.*panic
- •Handle JoinError from task.await
- •Use catch_unwind in spawned task
Tokio timeout elapsed
tokio.*elapsed.*deadline has elapsed
- •Increase timeout duration
- •Handle Elapsed error gracefully
Iterator consumed by move
borrow of moved value.*iterator
- •Use .iter() for borrowing iteration
- •Use .into_iter() intentionally for consuming
Temporary dropped while reference alive
temporary value dropped while borrowed.*let
- •Bind temporary to let variable
- •Extend temporary lifetime with let binding
Macro invocation incomplete
macro.*unexpected end of macro invocation
- •Add missing arguments to macro call
- •Check macro definition for required tokens
FFI improper C type usage
FFI.*type.*improper_ctypes
- •Use #[repr(C)] on struct for FFI
- •Replace with C-compatible type
Double mutable borrow
cannot borrow.*as mutable more than once
- •Split borrows into separate scopes
- •Use Cell/RefCell for interior mutability
Type length limit overflow
overflow evaluating the requirement.*type_length_limit
- •Add #![type_length_limit = "N"]
- •Reduce generic nesting depth
Serde JSON parse error at position
serde.*invalid value.*expected.*at line.*column
- •Validate JSON structure before parsing
- •Check for trailing commas or invalid syntax
Higher-ranked lifetime error
higher-ranked lifetime error
- •Simplify lifetime bounds
- •Use Box<dyn> to erase problematic lifetimes
Trait object not allowed in const
trait object.*dyn.*not allowed in const
- •Use generic with impl Trait instead
- •Use enum dispatch for const context
Derive macro doesn't handle generics
proc-macro.*derive.*does not handle.*generics
- •Add generic handling to proc macro impl
- •Use syn::Generics to parse type params
Error conversion From trait missing
the trait.*From<.*Error>.*is not implemented
- •Implement From<SourceError> for target
- •Use #[from] with thiserror derive
Async closure not stable
async.*closure.*not.*stable|async closures are unstable
- •Use move || async move { } pattern instead
- •Create async fn and pass as reference
pin-project invalid pin annotation
pin_project.*#\[pin\].*not allowed on this field
- •Only use #[pin] on fields needing pinning
- •Remove #[pin] from non-Future fields
Serde enum with data as map key
serde.*cannot serialize.*enum.*with.*data.*as map key
- •Implement custom Serialize for key type
- •Use String key with conversion
Type not found in external crate
cannot find type.*in.*extern crate
- •Check crate version for API changes
- •Enable required feature flag on dependency
Conflicting trait implementations
conflicting implementations of trait.*for type
- •Use newtype pattern to avoid overlap
- •Add more specific bounds to one impl
Orphan rule - potential future conflict
upstream crates may add.*impl.*in future versions
- •Use newtype wrapper pattern
- •Move impl to crate that owns the type
Actix payload already consumed
actix.*Payload.*already consumed
- •Use single body extractor per handler
- •Buffer payload with web::Bytes first
Tower service timeout
tower.*timeout.*elapsed
- •Increase tower::timeout::Timeout duration
- •Add retry layer after timeout
Mutable static access requires unsafe
unsafe.*mutable.*static.*requires unsafe
- •Use std::sync::OnceLock or LazyLock
- •Use atomic types for simple values
Returning reference to local variable
cannot return reference to.*local variable
- •Return owned value (String, Vec, etc.)
- •Use Cow for flexible ownership
Axum router merge state type mismatch
axum.*Router.*merge.*state.*mismatch
- •Use same state type across merged routers
- •Convert state with .with_state() before merge
Rc used where Send required
Send.*not implemented for.*Rc<
- •Use Arc instead of Rc for thread safety
- •Clone data instead of sharing with Rc
Associated type not specified in trait bound
trait.*associated type.*not specified
- •Add Item = Type to trait bound
- •Specify all associated types
Non-FFI-safe type in extern block
extern.*block uses.*type.*which is not FFI-safe
- •Use C-compatible types (i32, *const, etc.)
- •Add #[repr(C)] to struct definitions
Type not Sync for shared access
Sync.*not implemented.*cannot be shared between threads
- •Use Mutex/RwLock for synchronized access
- •Use Arc<Mutex<T>> for shared mutable state
Future not Unpin for polling
future.*returned.*does not implement.*Unpin
- •Use Box::pin(future) to pin on heap
- •Use pin_mut! macro from pin-utils
FnMut closure moves value on repeat call
cannot.*move.*closure.*FnMut.*called multiple times
- •Clone value inside closure each call
- •Use &mut reference instead of moving
Must-use value ignored
unused.*must be used.*#\[must_use\]
- •Handle the Result/Option
- •Use let _ = expr to intentionally discard
Proc macro wrong expansion context
procedural macro.*cannot expand to.*statements
- •Use attribute macro for statement context
- •Return valid TokenStream for position
Serde i128 not supported by format
serde.*i128.*not supported
- •Use i64 or String for large numbers
- •Enable i128 feature on serde
Borrowed data escapes scope
error\[E0521\].*borrowed data escapes outside of
- •Extend lifetime of borrowed data
- •Return owned type instead
Cargo package verification failure
cargo.*failed to verify.*package.*tarball
- •Run cargo package --list to check included files
- •Fix .gitignore excluding required files
Mutable borrow while immutable borrow exists
cannot borrow.*as mutable because it is also borrowed as immutable
- •Clone the data to avoid shared references
- •Restructure code so immutable borrow ends before mutable borrow begins
Value does not live long enough for lifetime
lifetime.*does not live long enough
- •Extend the lifetime of the borrowed value by moving it to an outer scope
- •Clone the value instead of borrowing it
Required trait not implemented
the trait.*is not implemented for
- •Add #[derive(TraitName)] to the struct if it's a standard trait
- •Implement the trait manually with an impl block
Use of value after move
value used here after move
- •Clone the value before the move if it implements Clone
- •Use a reference (&T) instead of moving ownership
Type mismatch in expression
mismatched types.*expected.*found
- •Convert the type explicitly using .into() or as keyword
- •Check function signature for expected parameter types
Undefined value in scope
cannot find value.*in this scope
- •Check for typos in the variable name
- •Bring the value into scope with use statement
Unused variable warning
unused variable:.*#\[warn\(unused_variables\)\]
- •Prefix the variable with underscore: _variable_name
- •Remove the variable if it's truly unnecessary
Multiple mutable borrows
cannot borrow.*as mutable more than once at a time
- •Restructure to use only one mutable reference at a time
- •Split the struct into separate fields that can be borrowed independently
Borrow of value after it was moved
error\[E0382\].*borrow of moved value
- •Clone the value before the move
- •Use references instead of moving ownership
Unsized type used where sized is required
the size for values of type.*cannot be known at compilation time
- •Box the value: Box<dyn Trait> instead of dyn Trait
- •Use a reference &dyn Trait instead of owned dyn Trait
Expected type but found unit ()
error\[E0308\].*expected.*found.*\()
- •Remove the trailing semicolon from the last expression in the block
- •Add an explicit return statement with the correct value
Method not found on type
no method named.*found for.*in the current scope
- •Import the trait that provides the method with use statement
- •Check the type — you may need to dereference or convert first
Cannot move out of shared reference
cannot move out of.*which is behind a shared reference
- •Clone the value instead of moving it
- •Use .as_ref() or pattern match with ref keyword
Missing lifetime annotation
error\[E0106\].*missing lifetime specifier
- •Add explicit lifetime parameter: fn foo<'a>(x: &'a str) -> &'a str
- •Return an owned type instead of a reference if possible
Undeclared crate or module
failed to resolve.*use of undeclared.*crate
- •Add the crate to [dependencies] in Cargo.toml
- •Run cargo build to download the dependency
Array/vector index out of bounds panic
thread '.*' panicked at '.*index out of bounds
- •Use .get(index) which returns Option instead of panicking
- •Check length before indexing
Type does not implement Send for async/threading
error\[E0277\].*the trait bound.*Send.*is not satisfied
- •Ensure all types held across await points implement Send
- •Use Arc<Mutex<T>> instead of Rc<RefCell<T>> for thread-safe sharing
Function or associated item not found
error\[E0599\].*no function or associated item named.*found
- •Check for typos in the function name
- •Import the correct module or use the full path
System library not found by pkg-config during build
package.*was not found in the pkg-config search path
- •Install the system development package (e.g., apt install libssl-dev)
- •Set PKG_CONFIG_PATH to include the library's .pc file directory
Cannot move out of dereference
error\[E0507\].*cannot move out of.*dereference of
- •Use .clone() to get an owned copy
- •Match with ref keyword to borrow instead of move