openproblems-bio / openproblems-v2

Formalizing and benchmarking open problems in single-cell genomics
MIT License
56 stars 19 forks source link

Long and confusing error message on config parse failure #121

Closed scottgigante-immunai closed 1 year ago

scottgigante-immunai commented 1 year ago

This should be a short and simple error message, instead it's 50 lines including a link to github issues and a deep stack trace.

✗ viash test src/label_projection/methods/scanvi_xgboost/config.vsh.yaml
Unexpected error occurred! If you think this is a bug, please post
create an issue at https://github.com/viash-io/viash/issues containing
a reproducible example and the stack trace below.

viash - 0.7.0
Stacktrace:
java.lang.RuntimeException: Type float is not recognised. Valid types are string, integer, long, double, boolean, boolean_true, boolean_false and file.
        at io.viash.functionality.arguments.package$.$anonfun$decodeDataArgument$1(package.scala:126)
        at io.circe.Decoder$$anon$16.apply(Decoder.scala:493)
        at io.circe.SeqDecoder.apply(SeqDecoder.scala:17)
        at io.circe.Decoder.tryDecode(Decoder.scala:70)
        at io.circe.Decoder.tryDecode$(Decoder.scala:69)
        at io.circe.SeqDecoder.tryDecode(SeqDecoder.scala:6)
        at io.circe.generic.extras.decoding.ReprDecoder.orDefault(ReprDecoder.scala:47)
        at io.viash.functionality.package$anon$lazy$macro$119$1$$anon$2.configuredDecode(package.scala:37)
        at io.circe.generic.extras.decoding.ConfiguredDecoder$NonStrictCaseClassConfiguredDecoder.apply(ConfiguredDecoder.scala:81)
        at io.circe.Decoder$$anon$7.$anonfun$apply$5(Decoder.scala:214)
        at scala.Option.getOrElse(Option.scala:201)
        at io.circe.Decoder$$anon$7.apply(Decoder.scala:214)
        at io.circe.generic.extras.decoding.ConfiguredDecoder$StrictCaseClassConfiguredDecoder.apply(ConfiguredDecoder.scala:122)
        at io.circe.Decoder.tryDecode(Decoder.scala:70)
        at io.circe.Decoder.tryDecode$(Decoder.scala:69)
        at io.circe.generic.decoding.DerivedDecoder.tryDecode(DerivedDecoder.scala:6)
        at io.circe.Decoder$$anon$11.tryDecode(Decoder.scala:300)
        at io.circe.generic.extras.decoding.ReprDecoder.orDefault(ReprDecoder.scala:47)
        at io.viash.config.package$anon$lazy$macro$31$1$$anon$2.configuredDecode(package.scala:31)
        at io.circe.generic.extras.decoding.ConfiguredDecoder$NonStrictCaseClassConfiguredDecoder.apply(ConfiguredDecoder.scala:81)
        at io.circe.Decoder.tryDecode(Decoder.scala:70)
        at io.circe.Decoder.tryDecode$(Decoder.scala:69)
        at io.circe.generic.decoding.DerivedDecoder.tryDecode(DerivedDecoder.scala:6)
        at io.circe.Decoder$$anon$11.tryDecode(Decoder.scala:300)
        at io.circe.Decoder$$anon$11.apply(Decoder.scala:299)
        at io.circe.Json.as(Json.scala:107)
        at io.viash.config.Config$.readFromUri(Config.scala:260)
        at io.viash.config.Config$.read(Config.scala:226)
        at io.viash.Main$.readConfig(Main.scala:351)
        at io.viash.Main$.mainCLI(Main.scala:220)
        at io.viash.Main$.mainCLIOrVersioned(Main.scala:117)
        at io.viash.Main$.main(Main.scala:64)
        at io.viash.Main.main(Main.scala)
rcannood commented 1 year ago

I agree the stack trace is not relevant in this particular situation. I'll look into whether we can omit the stack trace in some situations.

However, this is a Viash related suggestion, so I'll transfer the issue to that repo.

scottgigante-immunai commented 1 year ago

Let's leave this open until that issue is closed -- I consider this still a problem with this repo, even if the solution should be applied elsewhere.

rcannood commented 1 year ago

This issue was solved in Viash 0.7.5. Example when I make a typo in the type:

$ viash config view src/tasks/dimensionality_reduction/methods/neuralee/config.vsh.yaml
viash: Error parsing, invalid Viash Config content in file 'file:/home/rcannood/workspace/openproblems/openproblems-v2/src/tasks/dimensionality_reduction/methods/neuralee/config.vsh.yaml'.
Details:
Type 'nteger' is not recognised. Valid types are 'string', 'integer', 'long', 'double', 'boolean', 'boolean_true', 'boolean_false', and 'file'.
{
  "name" : "--n_hvg",
  "type" : "nteger",
  "description" : "Number of highly variable genes to subset to. If not specified, the input matrix will not be subset.",
  "default" : 1000
}