detect cycles before expanding the tag, show the hierarchy in exception message
let the library user decide whether to throw an exception when maximum depth is reached