hpyhacking/peatio · error · Handlebars.Exception

You must pass a string or Handlebars AST to Handlebars.preco

Error message

You must pass a string or Handlebars AST to Handlebars.precompile. You passed {}

What it means

Error "You must pass a string or Handlebars AST to Handlebars.precompile. You passed {}" thrown in hpyhacking/peatio.

Source

Thrown at app/assets/javascripts/swagger-ui/lib/handlebars-1.0.0.js:2138

  " double import public let yield"
).split(" ");

var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};

for(var i=0, l=reservedWords.length; i<l; i++) {
  compilerWords[reservedWords[i]] = true;
}

JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
  if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)) {
    return true;
  }
  return false;
};

Handlebars.precompile = function(input, options) {
  if (input == null || (typeof input !== 'string' && input.constructor !== Handlebars.AST.ProgramNode)) {
    throw new Handlebars.Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input);
  }

  options = options || {};
  if (!('data' in options)) {
    options.data = true;
  }
  var ast = Handlebars.parse(input);
  var environment = new Compiler().compile(ast, options);
  return new JavaScriptCompiler().compile(environment, options);
};

Handlebars.compile = function(input, options) {
  if (input == null || (typeof input !== 'string' && input.constructor !== Handlebars.AST.ProgramNode)) {
    throw new Handlebars.Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input);
  }

  options = options || {};
  if (!('data' in options)) {

View on GitHub (pinned to dab8641137)

Solutions

  1. Pass the template as a source string (or a Handlebars AST) to Handlebars.precompile; convert DOM nodes or other objects to their HTML string first.

When it happens

Trigger: Thrown at app/assets/javascripts/swagger-ui/lib/handlebars-1.0.0.js:2138 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hpyhacking/peatio@dab8641137 (2026-08-23). Data as JSON: /api/errors/3f13c919c32d7355. Report an issue: GitHub.