PaperMC / PaperMC/Velocity

Very unintuitive error message for old configs with `ping-passthrough`

Open
#1,876 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
Java
Stars
2.3k
Forks
959
Avg merge
5d 10h
Merged PRs (30d)
2

Description

Expected Behavior

Old configs with a string value for ping-passthru should throw a more intuitive error or use the string value for a preset instead.

Actual Behavior

After #1870, old configs with ping-passthru break with the very cryptic error message of:

java.lang.ClassCastException: class java.lang.String cannot be cast to class com.electronwill.nightconfig.core.Config

Steps to Reproduce

Make a config

Plugin List

Not relevant

Velocity Version

Latest, commit SHA 21bbf35d1da1d8a74aad897ecb4e6915f121898d

Additional Information

This is to be expected, as we're trying to pass a String to a parameter, that accepts Config, but it took me a good while of digging to find the culprit.

If it were up to me to fix this, I'd define some presets, which a string value can correlate to, so that old configs don't break and backwards compatibility is retained

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with an old config using a string value for ping-passthru, then trace the handling introduced by #1870. Done means the configuration either accepts the legacy string as a preset or reports an intuitive, actionable error instead of the ClassCastException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.