assertValidId = (id, petName) => {
  if (typeof id !== 'string' || !idPattern.test(id)) {
    let message = `Invalid formula identifier ${q(id)}`;
    if (petName !== undefined) {
      message += ` for pet name ${q(petName)}`;
    }
    throw new Error(message);
  }
}
@param {string} id
@param {string} [petName]
@returns {void}