tursodatabase/turso · critical · anyhow::Error

Failed to register completion extension

Error message

Failed to register completion extension

What it means

Returned during tursodb CLI initialization when limbo_completion::register_extension_static fails on the freshly built extension API context (cli/app.rs:282). This extension powers tab-completion in the interactive shell; when registration fails, startup aborts entirely. The code checks the returned status flag, not a panic.

Solutions

  1. Clean rebuild: cargo clean && cargo build, then rerun the CLI
  2. Build with default features so the completion extension is included
  3. If it persists on a clean tree, print the status returned by register_extension_static to surface the underlying error
  4. Report it with the exact commit - a failing static registration on a clean build indicates an ABI break

Example fix

# before
cargo build --no-default-features --bin tursodb
# after
cargo build --bin tursodb
Defensive patterns

Strategy: fallback

Try / catch

if !limbo_completion::register_extension_static(&mut ext_api).is_ok() {
    eprintln!("warning: tab completion disabled");
    // continue without completion instead of aborting startup
}
conn._free_extension_ctx(ext_api);

Prevention

When it happens

Trigger: Building the CLI with mismatched feature flags so the completion extension is compiled out or its registration entry point changed; version skew between turso_core's extension ABI and limbo_completion after a partial incremental rebuild; allocation failure while building the extension context.

Common situations: Incremental builds across rebases where core changed but the completion crate was not rebuilt; building with --no-default-features that excludes completion; vendored or patched extension crates drifting from the workspace.

Related errors


AI-assisted analysis of tursodatabase/turso@492c4a71cd (2026-08-20). Data as JSON: /api/errors/700358a88adb7aee. Report an issue: GitHub.

Appendix: source

Thrown at cli/app.rs:292

        let (io, conn) = if db_file.starts_with("file:") {
            Connection::from_uri(&db_file, db_opts, Arc::new(SqliteDialect))?
        } else {
            let flags = open_flags(opts.readonly);
            let (io, db) = Database::open_new(
                &db_file,
                opts.vfs.as_ref(),
                flags,
                db_opts.turso_cli(),
                None,
                Arc::new(SqliteDialect),
            )?;
            let conn = db.connect()?;
            (io, conn)
        };
        unsafe {
            let mut ext_api = conn._build_turso_ext();
            if !limbo_completion::register_extension_static(&mut ext_api).is_ok() {
                return Err(anyhow!(
                    "Failed to register completion extension".to_string()
                ));
            }
            conn._free_extension_ctx(ext_api);
        }
        let interrupt_count = Arc::new(AtomicUsize::new(0));
        {
            let interrupt_count: Arc<AtomicUsize> = Arc::clone(&interrupt_count);
            ctrlc::set_handler(move || {
                // Increment the interrupt count on Ctrl-C
                interrupt_count.fetch_add(1, Ordering::Release);
            })
            .expect("Error setting Ctrl-C handler");
        }
        let sql = opts.sql.take();
        let has_sql = sql.is_some();
        let quiet = opts.quiet || !IsTerminal::is_terminal(&std::io::stdin());
        let config = Config::for_output_mode(opts.output_mode);

View on GitHub (pinned to 492c4a71cd)