[Crash]: Unable to edit config file
ZephaniahNoah opened this issue ยท 12 comments
Minecraft Version
1.18.2
BYG Version
1.4.2
Terrablender Version
1.1.0.102
Mod Loader
Forge
Mod Loader Version
40.1.57
What happened?
The biomepedia button was on top of the diet mod button. I tried to change "visible" to false in the config but the game crashed on startup.
crash-log
crash-2022-08-01_13.41.16-fml.txt
latest.log
Did you isolate BYG?
I tried BYG alone
Same for me, crashes when i wanna add the configs for Biomepedia for server & client, after deleting the 2 json5 they created new and it works. but i cant edit anything... Fabric 1.18.2
Here is the crash report for Fabric 1.18.2 :
Crash Report
@SpigotDE Use a different file editor since the one you're using is saving null bytes, making it impossible to parse.
@ZephaniahNoah delete your trades config and let it regenerate.
@SpigotDE Use a different file editor since the one you're using is saving null bytes, making it impossible to parse.
This is happening to me with VS Code in plaintext and as JSONC. Since the comments even suggest using VS Code, I doubt that's the issue, but while I was reluctant to install a new extension when JSON with comments is already supported by the base, I did it anyway; no luck. Using the suggested extension with the suggested editor, I'm also unable to edit these configs.
Okay, so because this is an actual issue, but it has been closed as not one, I don't really know where to put this, but I wouldn't feel good not helping others struggling with this. Sorry if it gets lost to obscurity, but if it helps anyone, that would be good enough for me.
The problem here stems from a VS Code setting that's enabled by default called Files: Insert Final Newline
(File > Preferences > Settings). Disabling this option allowed me to delete the trailing whitespace that was getting appended on each save. After that, the adjustment to disable the button worked just fine.
Also, for the record, this was not at all inserting 00
s. Instead, and this is just a theory, but when the files are being read in by the JSON parsing library, they're coming in as UTF-16, and being misreported as null bytes because of the byte-doubling from the UTF-8 that it was actually saved as. As such, and depending on LE/BE, you're either going to end up with a 00 0A
or a 0A 00
.
Regardless, the point is that the library reading the JSON is likely at fault, but the problem is solvable by removing the trailing whitespace from the file.
Hope that helps someone.
Yes, this is still an issue. The parser cannot parse valid JSON5 files. This should not be closed. This is a MAJOR regression for all of minecraft going back to the 1.8 days when basic things like parsing config files ends in a game crash. Blaming users and their editors is not only poor taste, but really lame. I'm actually an engineer. I can reproduce this with VIM, IDEA and VSCode. This is absolutely 100% broken as it requires trailing whitespace to parse the file. That does not make a valid file, but an invalid and broken parser.
@CorgiTaco This is a bug in Jankson. falkreon/Jankson#56 I'd advise not dismissing users on this. It is a major issue that disallows editing in a lot of cases. This is a really bad parser, imo. They also have a bunch of bugs related to nitpicky things like forcing use of \t for indentation. There are theoretical fixes in their latest releases, so maybe an update would resolve this? Anyhow, this is an absolute garbage json parser, fraught with very simplistic bugs where it has issues with file parsing for valid files.
@wendall911 if you have a link to an alternative JSON parser with comment support I'd be willing to switch if it isn't to difficult.
@ZephaniahNoah delete your trades config and let it regenerate.
Didn't work :C
Still crashes on startup
@CorgiTaco https://github.com/FasterXML/jackson is probably the most widely used across java projects. You can configure to allow comments https://fasterxml.github.io/jackson-core/javadoc/2.13/com/fasterxml/jackson/core/JsonParser.Feature.html#ALLOW_COMMENTS
I just ported a mod to Fabric as well. It is sad that we are losing years of progress with configs in Fabric. Many mods don't even support configurations now as a result. Hopefully a solution is found for this!
I did see that Jankson appears to have fixes in their git repo, but have yet to release anything so I didn't build to see if the issues are actually addressed.
Strong opinions in this thread.
Jankson does not require tabs in the slightest for input, although it will write tabs for output. This will be easier to configure in 2.x
Closed or not, bugfixes are here. You should see Jankson 1.2.2 soon on mavencentral (as soon as it finishes replicating), which will fix this issue.