onetimesecret/onetimesecret · error · RuntimeError

Must run as root or with sudo

Error message

Must run as root or with sudo

What it means

Error "Must run as root or with sudo" thrown in onetimesecret/onetimesecret.

Source

Thrown at lib/onetime/cli.rb:38

    # Dry::CLI 1.4.1 never coerces `type: :integer` / `type: :float`, so a
    # supplied flag would reach `call` as a String while an omitted one keeps
    # the declared numeric default. That is fixed one level up, in dispatch:
    # require_relative 'cli/option_types' above prepends a hook to Dry::CLI
    # itself, so it applies to every command regardless of base class and no
    # command's ancestor chain is touched. See that file for the analysis.
    class Command < Dry::CLI::Command
      def boot_application!
        # Make sure all the models are loaded before calling boot
        OT.boot! :cli
      end

      protected

      def require_sudo
        return if Process.uid.zero?
        return if ENV['RACK_ENV'] == 'test'

        raise 'Must run as root or with sudo'
      end

      def verbose?
        ARGV.any? { |arg| ['-v', '--verbose'].include?(arg) }
      end

      def debug?
        OT.debug?
      end

      def valid_email?(email)
        return false if email.nil? || email.to_s.empty?

        Truemail.validate(email.to_s).result.valid?
      end
    end

    # Command class that delays boot (for commands that handle boot themselves)

View on GitHub (pinned to f81295e41b)

Solutions

  1. Re-run the command with sudo or as the root user.

When it happens

Trigger: Thrown at lib/onetime/cli.rb:38 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of onetimesecret/onetimesecret@f81295e41b (2026-08-23). Data as JSON: /api/errors/66465cdc4a27b137. Report an issue: GitHub.