Add more common issues to look for in logs (#363)

* remove exitcode `-805306369` triggering oom

* missing mod dependencies on forge

* legacyjavafixer

* `Couldn't extract native jar` fix

* detect launching offline without having minecraft assets downloaded

* missing indium with sodium

* out of disk space

* 32 bit java

* wrong intermediary mappings version

* `-Dfml.ignoreInvalidMinecraftCertificates=true`

* cleanup

* tell people using prism 8.0+ to update just by pressing `Update` in prism

* Apply suggestions from code review

Co-authored-by: TheKodeToad <TheKodeToad@proton.me>
Signed-off-by: maskers <97827489+maskersss@users.noreply.github.com>

* Update src/handlers/event/analyze_logs/issues.rs

Co-authored-by: TheKodeToad <TheKodeToad@proton.me>
Signed-off-by: maskers <97827489+maskersss@users.noreply.github.com>

* remove some backticks

* Apply suggestions from code review

Co-authored-by: seth <getchoo@tuta.io>
Signed-off-by: maskers <97827489+maskersss@users.noreply.github.com>

* cleanup

---------

Signed-off-by: maskers <97827489+maskersss@users.noreply.github.com>
Co-authored-by: maskers <97827489+mskrss@users.noreply.github.com>
Co-authored-by: TheKodeToad <TheKodeToad@proton.me>
Co-authored-by: seth <getchoo@tuta.io>
This commit is contained in:
maskers 2024-08-08 03:09:40 +03:00 committed by GitHub
parent 896ba37604
commit abe4b74dde
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -23,6 +23,15 @@ pub async fn find(log: &str, data: &Data) -> Result<Vec<(String, String)>> {
optinotfine,
pre_1_12_native_transport_java_9,
wrong_java,
forge_missing_dependencies,
legacyjavafixer,
locked_jar,
offline_launch,
frapi,
no_disk_space,
java_32_bit,
intermediary_mappings,
old_forge_new_java,
];
let mut res: Vec<(String, String)> = issues.iter().filter_map(|issue| issue(log)).collect();
@ -166,7 +175,7 @@ fn oom(log: &str) -> Issue {
"Allocating more RAM to your instance could help prevent this crash.".to_string(),
);
let found = log.contains("java.lang.OutOfMemoryError") || log.contains("-805306369");
let found = log.contains("java.lang.OutOfMemoryError");
found.then_some(issue)
}
@ -216,10 +225,17 @@ async fn outdated_launcher(log: &str, data: &Data) -> Result<Issue> {
|| (log_version_parts[0] == latest_version_parts[0]
&& log_version_parts[1] < latest_version_parts[1])
{
let issue = (
"Outdated Prism Launcher".to_string(),
format!("Your installed version is {log_version}, while the newest version is {latest_version}.\nPlease update; for more info see https://prismlauncher.org/download/")
);
let issue = if log_version_parts[0] < 8 {
(
"Outdated Prism Launcher".to_string(),
format!("Your installed version is {log_version}, while the newest version is {latest_version}.\nPlease update; for more info see https://prismlauncher.org/download/")
)
} else {
(
"Outdated Prism Launcher".to_string(),
format!("Your installed version is {log_version}, while the newest version is {latest_version}.\nPlease update by pressing the `Update` button in the launcher or using your package manager.")
)
};
Ok(Some(issue))
} else {
@ -271,3 +287,115 @@ fn wrong_java(log: &str) -> Issue {
log.contains("Java major version is incompatible. Things might break.")
.then_some(issue)
}
fn forge_missing_dependencies(log: &str) -> Issue {
let issue = (
"Missing mod dependencies".to_string(),
"You seem to be missing mod dependencies.
Search for \"mandatory dependencies\" in your log."
.to_string(),
);
let found = log.contains("Missing or unsupported mandatory dependencies");
found.then_some(issue)
}
fn legacyjavafixer(log: &str) -> Issue {
let issue = (
"LegacyJavaFixer".to_string(),
"You are using a modern Java version with an old Forge version, which is causing this crash.
MinecraftForge provides a coremod to fix this issue, download it [here](https://dist.creeper.host/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar)."
.to_string(),
);
let found = log.contains(
"[SEVERE] [ForgeModLoader] Unable to launch\njava.util.ConcurrentModificationException",
);
found.then_some(issue)
}
fn locked_jar(log: &str) -> Issue {
let issue = (
"Locked Jars".to_string(),
"Something is locking your library jars.
To fix this, try rebooting your PC."
.to_string(),
);
let found = log.contains("Couldn't extract native jar");
found.then_some(issue)
}
fn offline_launch(log: &str) -> Issue {
let issue = (
"Missing Libraries".to_string(),
"You seem to be missing libraries. This is usually caused by launching offline before they can be downloaded.
To fix this, first ensure you are connected to the internet. Then, try selecting Edit > Version > Download All and launching your instance again."
.to_string(),
);
let found = log.contains("(missing)\n");
found.then_some(issue)
}
fn frapi(log: &str) -> Issue {
let issue = (
"Missing Indium".to_string(),
"You are using a mod that needs Indium.
Please install it by going to Edit > Mods > Download Mods."
.to_string(),
);
let found = log
.contains("Cannot invoke \"net.fabricmc.fabric.api.renderer.v1.Renderer.meshBuilder()\"");
found.then_some(issue)
}
fn no_disk_space(log: &str) -> Issue {
let issue = (
"Out of disk space".to_string(),
"You ran out of disk space. You should free up some space on it.".to_string(),
);
let found = log.contains("There is not enough space on the disk");
found.then_some(issue)
}
fn java_32_bit(log: &str) -> Issue {
let issue = (
"32 bit Java crash".to_string(),
"You are using a 32 bit Java version. Please select 64 bit Java instead.
Check `/tag java` for more information."
.to_string(),
);
let found = log.contains("Could not reserve enough space for ")
|| log.contains("Invalid maximum heap size: ");
found.then_some(issue)
}
fn intermediary_mappings(log: &str) -> Issue {
let issue = (
"Wrong Intermediary Mappings version".to_string(),
"You are using Intermediary Mappings for the wrong Minecraft version.
Please select Change Version while it is selected in Edit > Version."
.to_string(),
);
let found = log.contains("Mapping source name conflicts detected:");
found.then_some(issue)
}
fn old_forge_new_java(log: &str) -> Issue {
let issue = (
"Forge on old Minecraft versions".to_string(),
"This crash is caused by using an old Forge version with a modern Java version.
To fix it, add the flag `-Dfml.ignoreInvalidMinecraftCertificates=true` to Edit > Settings > Java arguments."
.to_string(),
);
let found = log.contains(
"add the flag -Dfml.ignoreInvalidMinecraftCertificates=true to the 'JVM settings'",
);
found.then_some(issue)
}