meteor/meteor · error · Error

EJSON.parse argument should be a string

Error message

EJSON.parse argument should be a string

What it means

Error "EJSON.parse argument should be a string" thrown in meteor/meteor.

Source

Thrown at packages/ejson/ejson.js:506

  let serialized;
  const json = EJSON.toJSONValue(item);
  if (options && (options.canonical || options.indent)) {
    serialized = canonicalStringify(json, options);
  } else {
    serialized = JSON.stringify(json);
  }
  return serialized;
});

/**
 * @summary Parse a string into an EJSON value. Throws an error if the string
 *          is not valid EJSON.
 * @locus Anywhere
 * @param {String} str A string to parse into an EJSON value.
 */
EJSON.parse = (item) => {
  if (typeof item !== "string") {
    throw new Error("EJSON.parse argument should be a string");
  }
  return EJSON.fromJSONValue(JSON.parse(item));
};

/**
 * @summary Returns true if `x` is a buffer of binary data, as returned from
 *          [`EJSON.newBinary`](#ejson_new_binary).
 * @param {Object} x The variable to check.
 * @locus Anywhere
 */
EJSON.isBinary = (obj) => {
  return !!(
    (typeof Uint8Array !== "undefined" && obj instanceof Uint8Array) ||
    (obj && obj.$Uint8ArrayPolyfill)
  );
};

/**

View on GitHub (pinned to 5076d2f818)

Solutions

  1. Pass a JSON string to EJSON.parse.
  2. If you already have an object, use it directly instead of parsing.

When it happens

Trigger: Thrown when EJSON.parse is given a non-string argument.

Common situations: Passing an object, buffer, or undefined to EJSON.parse instead of a JSON string.


AI-assisted analysis of meteor/meteor@5076d2f818 (2026-08-13). Data as JSON: /api/errors/1d51f4feb622041b. Report an issue: GitHub.