{"record":{"id":"ac3ed2e0f6a2d069","repo":"DatabaseCleaner/database_cleaner","slug":"env-database-url-is-set-to-a-url-that-is-not-on","errorCode":null,"errorMessage":"ENV['DATABASE_URL'] is set to a URL that is not on the allowlist. Please refer to https://github.com/DatabaseCleaner/database_cleaner#safeguards","messagePattern":"ENV\\['DATABASE_URL'\\] is set to a URL that is not on the allowlist\\. Please refer to https://github\\.com/DatabaseCleaner/database_cleaner#safeguards","errorType":"exception","errorClass":"DatabaseCleaner::Safeguard::Error::UrlNotAllowed","httpStatus":null,"severity":"error","filePath":"lib/database_cleaner/safeguard.rb","lineNumber":28,"sourceCode":"      end\n\n      class ProductionEnv < Error\n        def initialize(env)\n          super(\"ENV['#{env}'] is set to production. Please refer to https://github.com/DatabaseCleaner/database_cleaner#safeguards\")\n        end\n      end\n\n      class UrlNotAllowed < Error\n        def initialize\n          super(\"ENV['DATABASE_URL'] is set to a URL that is not on the allowlist. Please refer to https://github.com/DatabaseCleaner/database_cleaner#safeguards\")\n        end\n      end\n    end\n\n    class AllowedUrl\n      def run\n        return if skip?\n        raise Error::UrlNotAllowed if database_url_not_allowed?\n      end\n\n      private\n\n        def database_url_not_allowed?\n          !DatabaseCleaner.url_allowlist.any? {|allowed| allowed === ENV['DATABASE_URL'] }\n        end\n\n        def skip?\n          !DatabaseCleaner.url_allowlist\n        end\n    end\n\n\n    class RemoteDatabaseUrl\n      LOCAL = %w(localhost 127.0.0.1)\n\n      def run","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/DatabaseCleaner/database_cleaner/blob/09b47d03cce420c915b10eb595936ef4397b55ac/lib/database_cleaner/safeguard.rb#L10-L46","documentation":"Error \"ENV['DATABASE_URL'] is set to a URL that is not on the allowlist. Please refer to https://github.com/DatabaseCleaner/database_cleaner#safeguards\" thrown in DatabaseCleaner/database_cleaner.","triggerScenarios":"Thrown at lib/database_cleaner/safeguard.rb:28 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"09b47d03cce420c915b10eb595936ef4397b55ac","analyzedAt":"2026-08-23T14:53:55.093Z","schemaVersion":2},"datasetVersion":"2026-08-23T16:17:53.355Z"}