{"record":{"id":"45f2332aedeed191","repo":"databendlabs/databend","slug":"failed-to-register-new-admin-client","errorCode":null,"errorMessage":"Failed to register new_admin_client: {}","messagePattern":"Failed to register new_admin_client: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/control/src/lua_support.rs","lineNumber":420,"sourceCode":"            Ok(LuaGrpcClient::new(client))\n        })\n        .map_err(|e| anyhow::anyhow!(\"Failed to create new_grpc_client function: {}\", e))?;\n\n    metactl_table\n        .set(\"new_grpc_client\", new_grpc_client)\n        .map_err(|e| anyhow::anyhow!(\"Failed to register new_grpc_client: {}\", e))?;\n\n    // Register new_admin_client function\n    let new_admin_client = lua\n        .create_function(|_lua, address: String| {\n            let client = MetaAdminClient::new(&address);\n            Ok(LuaAdminClient::new(client))\n        })\n        .map_err(|e| anyhow::anyhow!(\"Failed to create new_admin_client function: {}\", e))?;\n\n    metactl_table\n        .set(\"new_admin_client\", new_admin_client)\n        .map_err(|e| anyhow::anyhow!(\"Failed to register new_admin_client: {}\", e))?;\n\n    // Export NULL constant to metactl namespace\n    metactl_table\n        .set(\"NULL\", Value::NULL)\n        .map_err(|e| anyhow::anyhow!(\"Failed to register NULL constant: {}\", e))?;\n\n    // Register spawn function that delegates to tokio::task::spawn_local\n    let spawn_fn = lua\n        .create_function(|_lua, func: mlua::Function| {\n            #[allow(clippy::disallowed_methods)]\n            let handle = tokio::task::spawn_local(async move {\n                match func.call_async::<mlua::Value>(()).await {\n                    Ok(result) => result,\n                    Err(e) => {\n                        eprintln!(\"Spawned task error: {}\", e);\n                        mlua::Value::Nil\n                    }\n                }","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/meta/control/src/lua_support.rs#L402-L438","documentation":"Setting the created new_admin_client function onto the `metactl` Lua table failed. This is the registration step after create_function; mlua's set() returned an error which is wrapped in this message.","triggerScenarios":"Lua table key assignment failing during setup — read-only or corrupted table, mlua incompatibilities, or memory exhaustion.","commonSituations":"Custom/sandboxed Lua states that block writes, broken mlua builds, OOM conditions while scripting with metactl.","solutions":["Use the standard metactl Lua environment without sandbox write restrictions","Rebuild with consistent mlua features","Retry after resolving memory issues","Upgrade metactl/mlua if the failure is a known regression"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match run_lua_script(&script) {\n    Err(e) if e.to_string().contains(\"Failed to register new_admin_client\") => {\n        eprintln!(\"metactl table write failed: {e}; check for sandboxing or corrupted state\");\n    }\n    other => other?,\n}","preventionTips":["Use the standard, unmodified metactl Lua environment","Assert required keys exist on the metactl table after setup","Keep mlua dependency versions consistent","Retry setup once on transient failures"],"tags":["lua","mlua","registration"],"backgroundTag":"module-init-failed","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"}