{"record":{"id":"66465cdc4a27b137","repo":"onetimesecret/onetimesecret","slug":"must-run-as-root-or-with-sudo","errorCode":null,"errorMessage":"Must run as root or with sudo","messagePattern":"Must run as root or with sudo","errorType":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"lib/onetime/cli.rb","lineNumber":38,"sourceCode":"    # Dry::CLI 1.4.1 never coerces `type: :integer` / `type: :float`, so a\n    # supplied flag would reach `call` as a String while an omitted one keeps\n    # the declared numeric default. That is fixed one level up, in dispatch:\n    # require_relative 'cli/option_types' above prepends a hook to Dry::CLI\n    # itself, so it applies to every command regardless of base class and no\n    # command's ancestor chain is touched. See that file for the analysis.\n    class Command < Dry::CLI::Command\n      def boot_application!\n        # Make sure all the models are loaded before calling boot\n        OT.boot! :cli\n      end\n\n      protected\n\n      def require_sudo\n        return if Process.uid.zero?\n        return if ENV['RACK_ENV'] == 'test'\n\n        raise 'Must run as root or with sudo'\n      end\n\n      def verbose?\n        ARGV.any? { |arg| ['-v', '--verbose'].include?(arg) }\n      end\n\n      def debug?\n        OT.debug?\n      end\n\n      def valid_email?(email)\n        return false if email.nil? || email.to_s.empty?\n\n        Truemail.validate(email.to_s).result.valid?\n      end\n    end\n\n    # Command class that delays boot (for commands that handle boot themselves)","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/onetimesecret/onetimesecret/blob/f81295e41bc3e808a3dd2cbea03ef65401a662e4/lib/onetime/cli.rb#L20-L56","documentation":"Error \"Must run as root or with sudo\" thrown in onetimesecret/onetimesecret.","triggerScenarios":"Thrown at lib/onetime/cli.rb:38 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-run the command with sudo or as the root user."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f81295e41bc3e808a3dd2cbea03ef65401a662e4","analyzedAt":"2026-08-23T21:13:10.635Z","schemaVersion":2},"datasetVersion":"2026-08-24T02:17:37.098Z"}