Skip to content

rtk init -g shows redundant "run rtk init -g" warning #1011

Closed

Description

@andeart

Description

Running rtk init -g prints a confusing warning before it has a chance to install the hook:

$ rtk init -g
[rtk] /!\ No hook installed — run `rtk init -g` for automatic token savings

The warning tells the user to run the exact command they're already running.

Steps to Reproduce

  1. Uninstall any existing hooks: rtk init -g --uninstall
  2. Reset the rate-limit marker: rm ~/Library/Application\ Support/rtk/.hook_warn_last
  3. Run rtk init -g
  4. Observe the redundant warning before the hook is installed

Root Cause

maybe_warn() in hook_check.rs fires for all commands except Gain before the command dispatches. When the command is Init, the hook hasn't been installed yet, so the check sees a missing hook and warns.

The warning is also rate-limited to once per day, making it hard to reproduce consistently.

Expected Behavior

rtk init -g should not warn missing hooks nor redundantly recommend running rtk init -g again. If anything, it should indicate that it's about to install the hooks.

Activity

  1. changed the title [-]`rtk init -g` shows misleading "No hook installed" warning[/-] [+]`rtk init -g` shows redundant "run rtk init -g" warning[/+] on Apr 4, 2026
  2. changed the title [-]`rtk init -g` shows redundant "run rtk init -g" warning[/-] [+]`rtk init -g` shows redundant "run `rtk init -g`" warning[/+] on Apr 4, 2026
  3. added
    bug
    effort-small
    good first issue
    on Apr 4, 2026
  4. pszymkowiak commented on Apr 4, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟢 Priority low
    🎯 Confidence 93%

    Summary

    rtk init -g fires the missing-hook warning before the hook is installed, telling the user to run the command they're already running; fix is to exclude Init from maybe_warn() in hook_check.rs — PR #1013 already addresses this.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.

    📁 Relevant files
    • src/hook_check.rs

    Triaged automatically by wshm · This is an automated analysis, not a human review.

  5. andeart commented on Apr 4, 2026

    @andeart
    Author

    Appreciate the automated check. I made the same fix already in #1013.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clibugeffort-smallgood first issuepriority:low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions