{"record":{"id":"d4297b1487ebe38d","repo":"databendlabs/databend","slug":"memory-exceeds-limit","errorCode":"MEMORY_EXCEEDS_LIMIT","errorMessage":"memory allocation of {layout.size()} bytes failed","messagePattern":"memory allocation of (.+?) bytes failed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/common/base/src/runtime/memory/alloc_error_hook.rs","lineNumber":48,"sourceCode":"    mark_alloc_error_panic();\n}\n\npub fn take_alloc_error_panic() -> bool {\n    ALLOC_ERROR_PANIC.with(|flag| flag.replace(false))\n}\n\npub fn is_alloc_error_panic() -> bool {\n    ALLOC_ERROR_PANIC.with(|flag| flag.get())\n}\n\npub fn set_alloc_error_hook() {\n    std::alloc::set_alloc_error_hook(|layout| {\n        let _guard = LimitMemGuard::enter_unlimited();\n\n        let out_of_limit_desc = ThreadTracker::replace_error_message(None);\n        mark_alloc_error_panic();\n\n        panic!(\n            \"{}\",\n            out_of_limit_desc\n                .unwrap_or_else(|| format!(\"memory allocation of {} bytes failed\", layout.size()))\n        );\n    })\n}\n","sourceCodeStart":30,"sourceCodeEnd":55,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/common/base/src/runtime/memory/alloc_error_hook.rs#L30-L55","documentation":"emit_walk_for_type handles Type::Path and a few other shapes; a Type::Path whose path has no final segment (an empty/degenerate path) produces this syn Error at compile time. It means the derive Walk/WalkMut encountered a field type it cannot even name.","triggerScenarios":"A field whose type is a syntactically degenerate type path (no segments) inside a type deriving Visit/WalkMut.","commonSituations":"Macro-generated or heavily manipulated types (e.g. from another macro) that yield empty paths; unusual type syntax such as bare associated-type edges produced by nested macros.","solutions":["Inspect the type at the reported span and replace the degenerate path with a concrete named type.","Check whether a macro expansion is producing an empty type path; fix or work around that macro.","If the type is legitimately unsupported (non-path, e.g. bare fn/trait object), expect error 406 instead and restructure it."],"exampleFix":"// before\nstruct N { f: macro_returning_empty_path!() }\n// after\nstruct N { f: ConcreteType }","handlingStrategy":"type-guard","validationCode":"// compile-time check: field types must be nameable paths\nfn assert_named_path<T>() {} // e.g. assert_named_path::<ConcreteFieldType>();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid macro-generated type paths as AST field types","Use concrete named types for AST node fields","Test derive expansion with trybuild snapshot tests"],"tags":["rust","proc-macro","compile-time","ast"],"backgroundTag":"unsupported-operation","analyzedSha":"288d84d76e20a2f8f7173bda9691eb6ece301aa9","analyzedAt":"2026-09-11T11:29:36.208Z","contentChangedAt":"2026-09-11T11:29:36.208Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}