rtk-ai/rtk · error

Kilo Code is project-scoped. Use: rtk init --agent kilocode

Error message

Kilo Code is project-scoped. Use: rtk init --agent kilocode

What it means

rtk's `rtk init --agent kilocode` configures Kilo Code hooks only at the project level (writing project-local config in the current repo). The library intentionally refuses the `--global` variant because Kilo Code has no supported global installation mode, and `anyhow::bail!` aborts the init command with this message instead of half-configuring a global setup.

Solutions

  1. Drop the `--global` flag: run `rtk init --agent kilocode` inside the project root you want configured
  2. If you need Kilo Code in many repos, script the project-scoped init in each repo (e.g. a bootstrap script that cd's into each repo and runs the init)
  3. Use a different agent that supports global mode if a machine-wide setup is a hard requirement

Example fix

// before
rtk init --agent kilocode --global
// after
rtk init --agent kilocode
Defensive patterns

Strategy: validation

Validate before calling

// shell guard before invoking rtk
if [[ "$RTK_INIT_FLAGS" == *--global* ]]; then echo "kilocode is project-scoped; drop --global"; exit 1; fi

Try / catch

// Rust caller
match rtk_init_kilocode(global) {
    Err(e) if e.to_string().contains("project-scoped") => retry_project_scoped(),
    Err(e) => return Err(e.context("rtk init failed")),
    Ok(v) => Ok(v),
}

Prevention

When it happens

Trigger: Running `rtk init --agent kilocode --global` (or an equivalent global flag) reaches src/main.rs:2446 where `agent == Some(AgentTarget::Kilocode)` and `global == true`.

Common situations: A developer wants Kilo Code hooks available across all repos and adds `--global` out of habit from other agents (Claude, Trae, Omp, Droid) that do support global mode; scripts migrated from another agent's init line.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of rtk-ai/rtk@0924356b4c (2026-09-19). Data as JSON: /api/errors/e1d47b1fb8c54da1. Report an issue: GitHub.

Appendix: source

Thrown at src/main.rs:2446

                    hooks::init::uninstall_with_patch_mode,
                )?;
            } else if gemini {
                hooks::init::run_gemini(global, hook_only, patch_mode, ctx)?;
            } else if copilot {
                if global {
                    hooks::init::run_copilot_global(ctx)?;
                } else {
                    hooks::init::run_copilot(ctx)?;
                }
            } else if agent == Some(AgentTarget::Pi) {
                hooks::init::run_pi_mode_with_patch_mode(global, patch_mode, ctx)?
            } else if agent == Some(AgentTarget::Trae) {
                hooks::init::run_trae_mode(global, ctx)?
            } else if agent == Some(AgentTarget::Omp) {
                hooks::init::run_omp_mode_with_patch_mode(global, patch_mode, ctx)?
            } else if agent == Some(AgentTarget::Kilocode) {
                if global {
                    anyhow::bail!("Kilo Code is project-scoped. Use: rtk init --agent kilocode");
                }
                hooks::init::run_kilocode_mode(ctx)?;
            } else if agent == Some(AgentTarget::Antigravity) {
                if global {
                    anyhow::bail!(
                        "Antigravity is project-scoped. Use: rtk init --agent antigravity"
                    );
                }
                hooks::init::run_antigravity_mode(ctx)?;
            } else if agent == Some(AgentTarget::Kimi) {
                if global {
                    anyhow::bail!("Kimi AI is project-scoped. Use: rtk init --agent kimi");
                }
                hooks::init::run_kimi_mode(ctx)?;
            } else if agent == Some(AgentTarget::Hermes) {
                hooks::init::run_hermes_mode(ctx)?;
            } else if agent == Some(AgentTarget::Droid) {
                hooks::init::run_droid_mode(global, ctx)?;

View on GitHub (pinned to 0924356b4c)