rtk-ai/rtk · error · anyhow::Error

Vibe support is global-only. Use: rtk init -g --agent vibe

Error message

Vibe support is global-only. Use: rtk init -g --agent vibe

What it means

Vibe support installs a pre_tool hook into ~/.vibe/hooks.toml (Vibe CLI's global hook registry) and, unless --hook-only, also drops ~/.vibe/prompts/rtk.md. Both are user-global, so run_vibe_mode bails on a project-scoped invocation before resolving or creating anything.

Source

Thrown at src/hooks/init.rs:4470

fn resolve_vibe_dir() -> Result<PathBuf> {
    resolve_home_subdir(VIBE_DIR)
}

/// Entry point for `rtk init -g --agent vibe`.
///
/// Installs a `pre_tool` hook into `~/.vibe/hooks.toml` (Vibe CLI's hook
/// registry, see https://docs.mistral.ai/vibe/code/cli/hooks) that routes
/// bash tool calls through the native `rtk hook vibe` binary. When not
/// `hook_only`, also drops an `~/.vibe/prompts/rtk.md` system prompt file
/// as a belt-and-suspenders fallback if the hook is disabled.
pub fn run_vibe_mode(
    global: bool,
    hook_only: bool,
    patch_mode: PatchMode,
    ctx: InitContext,
) -> Result<()> {
    if !global {
        anyhow::bail!("Vibe support is global-only. Use: rtk init -g --agent vibe");
    }
    let vibe_dir = resolve_vibe_dir()?;
    run_vibe_mode_at(&vibe_dir, hook_only, patch_mode, ctx)
}

fn run_vibe_mode_at(
    vibe_dir: &Path,
    hook_only: bool,
    patch_mode: PatchMode,
    ctx: InitContext,
) -> Result<()> {
    let InitContext { dry_run, .. } = ctx;
    if !dry_run {
        fs::create_dir_all(vibe_dir)
            .with_context(|| format!("Failed to create Vibe config dir: {}", vibe_dir.display()))?;
    }

    let hooks_path = vibe_dir.join(VIBE_HOOKS_FILE);

View on GitHub (pinned to d977e1c316)

Solutions

  1. Run `rtk init -g --agent vibe`
  2. Add --hook-only if you only want the hook and not the prompt file: `rtk init -g --agent vibe --hook-only`

Example fix

# before
rtk init --agent vibe   # error: global-only

# after
rtk init -g --agent vibe
Defensive patterns

Strategy: validation

Validate before calling

# bash: vibe is global-only
rtk init -g --agent vibe --dry-run   # preview writes to ~/.vibe

Prevention

When it happens

Trigger: `rtk init --agent vibe` without `-g` — src/hooks/init.rs:4478.

Common situations: New Vibe users copying a generic init command; automation running without a writable HOME.

Related errors


AI-assisted analysis of rtk-ai/rtk@d977e1c316 (2026-08-16). Data as JSON: /api/errors/0d9fc693bac47359. Report an issue: GitHub.