This message could be a lot better.
https://github.com/serde-rs/serde/blob/v0.9.7/serde_derive/src/de.rs#L750-L756
// TODO this message could be better by saving the errors from the failed
// attempts. The heuristic used by TOML was to count the number of fields
// processed before an error, and use the error that happened after the
// largest number of fields. I'm not sure I like that. Maybe it would be
// better to save all the errors and combine them into one message that
// explains why none of the variants matched.
let fallthrough_msg = format!("data did not match any variant of untagged enum {}", type_ident);
Closing as more complicated than it's worth. I would be willing to consider a PR that implements better error messages but I don't plan to pursue this as a priority.
I don't have a PR but I'd like to add my experience with this error in case someone want to pick this up.
I've hit this error as a consumer (not developer) of the [vector] logging binary. The error is confusing because I'm not sure what went wrong. Specifically, here was the rough mental debugging I went through:
ERROR vector: Configuration error: data did not match any variant of untagged enum
LuaConfig for key `transforms.journald_lua_transform`
data
?I've hit this error as a consumer (not developer) of the vector logging binary. The error is confusing because I'm not sure what went wrong. Specifically, here was the rough mental debugging I went through:
ERROR vector: Configuration error: data did not match any variant of untagged enum LuaConfig for key `transforms.journald_lua_transform`
@jschaf sounds like i'm hitting the exact error you are (even down to transforms.journald_lua_transform
). What was your eventual fix?
@jschaf sounds like i'm hitting the exact error you are (even down to transforms.journald_lua_transform). What was your eventual fix?
Sorry, I've forgotten most of the context. It might have been mismatch between the docs which show version 2 rules, and the vector implementation at the time which defaulted to version 1. I remember diving through the vector source code to figure out what version 1 expected.
If it helps, here's my current working invocation of that transform:
# Transform to extract whitelisted fields from the JournalD src.
[transforms.journald_src]
type = "lua"
version = "2"
inputs = ["journald_raw_src"]
search_dirs = ["/etc/vector/lua"]
source = "journald = require('journald')"
hooks.process = 'journald.extract_whitelisted_fields'
Most helpful comment
I don't have a PR but I'd like to add my experience with this error in case someone want to pick this up.
I've hit this error as a consumer (not developer) of the [vector] logging binary. The error is confusing because I'm not sure what went wrong. Specifically, here was the rough mental debugging I went through:
data
?