{"record":{"id":"e3bf87c77648e35e","repo":"rouge-ruby/rouge","slug":"unknown-token-tok-inspect-for-safe-val-inspe","errorCode":null,"errorMessage":"unknown token: #{tok.inspect} for #{safe_val.inspect}","messagePattern":"unknown token: #(.+?) for #(.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"lib/rouge/formatters/html.rb","lineNumber":40,"sourceCode":"\n      tag 'html'\n\n      # @yield the html output.\n      def stream(tokens, &b)\n        tokens.each { |tok, val| yield span(tok, val) }\n      end\n\n      def span(tok, val)\n        return val if escape?(tok)\n\n        safe_span(tok, escape_special_html_chars(val))\n      end\n\n      def safe_span(tok, safe_val)\n        if tok == Token::Tokens::Text\n          safe_val\n        else\n          shortname = tok.shortname or raise \"unknown token: #{tok.inspect} for #{safe_val.inspect}\"\n\n          \"<span class=\\\"#{shortname}\\\">#{safe_val}</span>\"\n        end\n      end\n\n      private\n\n      # A performance-oriented helper method to escape `&`, `<` and `>` for the rendered\n      # HTML from this formatter.\n      #\n      # `String#gsub` will always return a new string instance irrespective of whether\n      # a substitution occurs. This method however invokes `String#gsub` only if\n      # a substitution is imminent.\n      #\n      # Returns either the given `value` argument string as is or a new string with the\n      # special characters replaced with their escaped counterparts.\n      def escape_special_html_chars(value)\n        return value unless value =~ ESCAPE_REGEX","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/rouge-ruby/rouge/blob/bd7dad7b0939c556e582a0370686f6fc022c8af5/lib/rouge/formatters/html.rb#L22-L58","documentation":"Error \"unknown token: #{tok.inspect} for #{safe_val.inspect}\" thrown in rouge-ruby/rouge.","triggerScenarios":"Thrown at lib/rouge/formatters/html.rb:40 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":"bd7dad7b0939c556e582a0370686f6fc022c8af5","analyzedAt":"2026-08-23T11:34:50.713Z","schemaVersion":2},"datasetVersion":"2026-08-23T16:17:53.355Z"}