hpyhacking/peatio · error · Handlebars.Exception

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

Error message

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

What it means

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

Source

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

};

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)) {
    options.data = true;
  }
  var compiled;
  function compile() {
    var ast = Handlebars.parse(input);
    var environment = new Compiler().compile(ast, options);
    var templateSpec = new JavaScriptCompiler().compile(environment, options, undefined, true);
    return Handlebars.template(templateSpec);
  }

  // Template is only compiled on first use and cached after that point.
  return function(context, options) {
    if (!compiled) {
      compiled = compile();

View on GitHub (pinned to dab8641137)

Solutions

  1. Pass the template as a source string (or a Handlebars AST) to Handlebars.compile; 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:2152 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/ab64d4b22db6000a. Report an issue: GitHub.