Fork me on GitHub
#clj-yaml
<
2024-05-18
Ingy döt Net19:05:08

Has anyone ran into this with clj-yaml?

Error: org.snakeyaml.engine.v2.exceptions.YamlEngineException: The incoming YAML document exceeds the limit: 3145728 code points.

Ingy döt Net19:05:26

I know clj-yam uses snakeyaml, not snakeyaml-engine but same author

Ingy döt Net19:05:37

I'll try it out myself 🙂

borkdude19:05:31

have you tried grepping the clj-yaml repo for that number? that might give you some hints: https://github.com/search?q=repo%3Aclj-commons%2Fclj-yaml%203145728&amp;type=code

Ingy döt Net19:05:16

https://github.com/search?q=repo%3Asnakeyaml%2Fsnakeyaml+%22The+incoming+YAML+document+exceeds+the+limit%22&amp;type=code https://github.com/search?q=repo%3Asnakeyaml%2Fsnakeyaml+getCodePointLimit&amp;type=code Can't find that number in the code but: https://www.google.com/search?q=codePointLimit+3145728&amp;oq=codePointLimit+3145728 Is interesting. This is using clj-yaml under the hood:

$ ls -lh big.yaml 
-rw-r--r-- 1 ingy ingy 8.4M May 18 15:02 big.yaml
$ ys -e 'slurp("big.yaml").yaml/load()'
Error: The incoming YAML document exceeds the limit: 3145728 code points.

Ingy döt Net19:05:35

$ ys -pe '1024 * 1024 * 3'
3145728
🙂

Ingy döt Net19:05:05

not sure what inspired that limit for snakeyaml

Ingy döt Net19:05:03

I'm working on integrating a C++ parser (to replace snakeyaml-engine) into yamlscript and was testing on bigger inputs...

borkdude19:05:05

The link I posted gave the answer though

borkdude19:05:11

it's configurable

borkdude19:05:18

not sure if you understood that, just double-checking

Ingy döt Net20:05:53

Thanks. I missed that. I wouldn't have thought to look in the clojure code since it's a snake error. Makes sense though. Added less than a year ago it seems https://github.com/clj-commons/clj-yaml/commit/ab980163accdaf679090dc5ee93e7858e18768f0 @U5XL4TJ2C++

lread21:05:56

Yeah clj-yaml is a very thin wrapper over SnakeYAML. It does not translate SnakeYAML exceptions.