Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Error Messages Clearer #444

Open
wants to merge 24 commits into
base: develop
Choose a base branch
from

Conversation

OroArmor
Copy link
Member

@OroArmor OroArmor commented Aug 2, 2024

Massively improves the error messages reported by loader.

Example improvement:

mod-resolving-tests-normal breaks all versions of mod-resolving-tests-broken, which is present!

- - <mods>/normal.jar
+ Breaking mods: 
+ - Mandatory mod 'mod-resolving-tests-normal' version '1.0.0': <mods>/normal.jar
+
+ Broken mods: 
+ - Mandatory mod 'mod-resolving-tests-broken' version '1.0.0': <mods>/broken.jar

Additional improvements:

  • Fixes a bug with the unless clause being inverted!
  • Fixes an issue with the mod table where provided mods used the providing id and version
  • Modifies the handle solver error logic to find all of the rules that cause the break.
    • This might still need some improvement with plugins blaming specific rules.
  • Fixes a typo in OptionalModIdDefinition
  • Reduces the number of overloads in VersionRangeDescriber and adds documentation
    • The reason for these overloads was unclear, so this should reduce any issues with that.
  • Adds a new VersionRangeDescriber method for just describing a version from a mod
  • Adds a bunch of new tests to the mod resolving tests, which were mostly used to verify the outputs of the messages.
  • Adds a way to export a dot graph for the solver error.
    • Adding -Dloader.mod_solving.error.print_dot_graph=true to get the dot graph in the info log.
Full improvements to error messages:
Breaks:
 mod-resolving-tests-normal breaks all versions of mod-resolving-tests-broken, which is present!

-- <mods>/normal.jar
+Breaking mods: 
+- Mandatory mod 'mod-resolving-tests-normal' version '1.0.0': <mods>/normal.jar
+
+Broken mods: 
+- Mandatory mod 'mod-resolving-tests-broken' version '1.0.0': <mods>/broken.jar

image

Breaks Unless:
 mod_a breaks all versions of mod_b, which is present!
+However, if any version of mod_c is present, mod_a does not break mod_b.
 
-- <mods>/mod_a.jar
+Breaking mods: 
+- Mandatory mod 'mod_a' version '1.0.0': <mods>/mod_a.jar
+
+Broken mods: 
+- Mandatory mod 'mod_b' version '1.0.0': <mods>/mod_b.jar

image

Breaks on Broken Optional with an Unless:
 -- Error 1 --
 
-Unhandled solver error involving the following rules:
-Rule 1:
-Breakage for {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from <mods>/mod_a.jar/mod_b.jar} on mod_d versions [*] (1 breaking options, 0 okay options)
-	x {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_d' from <mods>/mod_d.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_d' from <mods>/mod_d.jar}
-Rule 2:
-Mandatory mod mod_d (mod_d) v1.0.0
-Rule 3:
-Dependency for  at line 10 column 18 path $.quilt_loader.breaks[0].unless on mod_b versions [*] (1 valid options, 0 invalid options)
-	+ {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from <mods>/mod_a.jar/mod_b.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from <mods>/mod_a.jar/mod_b.jar}
-Rule 4:
-Mandatory mod mod_c (mod_c) v1.0.0
-Rule 5:
-Mandatory mod mod_a (mod_a) v1.0.0
-Rule 6:
-Breakage for {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_a' from <mods>/mod_a.jar} on mod_c versions [*] (1 breaking options, 0 okay options)
-	x {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_c' from <mods>/mod_c.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_c' from <mods>/mod_c.jar}
+mod_b breaks all versions of mod_d, which is present!
 
+Breaking mods: 
+- Required optional mod 'mod_b' version '1.0.0': <mods>/mod_a.jar/mod_b.jar
+
+Broken mods: 
+- Mandatory mod 'mod_d' version '1.0.0': <mods>/mod_d.jar
+
+
+-- Error 2 --
+
+mod_a breaks all versions of mod_c, which is present!
+Normally, any version of mod mod_b overrides this break, but it is unable to load due to another error.
+
+Breaking mods: 
+- Mandatory mod 'mod_a' version '1.0.0': <mods>/mod_a.jar
+
+Broken mods: 
+- Mandatory mod 'mod_c' version '1.0.0': <mods>/mod_c.jar
+
+Overriding mods: 
+- Required optional mod 'mod_b' version '1.0.0': <mods>/mod_a.jar/mod_b.jar

image

Breaks with Unless Any:
 mod_a breaks all versions of mod_b, which is present!
+However, if any of the following are present, mod_a does not break.
+- Any version of mod_c which is missing.
+- Any version of mod_d which is missing.
 
-- <mods>/mod_a.jar
+Breaking mods: 
+- Mandatory mod 'mod_a' version '1.0.0': <mods>/mod_a.jar
+
+Broken mods: 
+- Mandatory mod 'mod_b' version '1.0.0': <mods>/mod_b.jar

image

Depends on any with an invalid option:
 -- Error 1 --
 
 mod_b requires any version of mod_d, which is missing!
 
-- <mods>/mod_b.jar
+Requiring mods: 
+- Required mandatory mod 'mod_b' version '1.0.0': <mods>/mod_b.jar
+
+
+-- Error 2 --
+
+mod_a depends on any of the following mods:
+- Any version of mod_b:
+  Satisfying mods which cannot load: 
+  - Required mandatory mod 'mod_b' version '1.0.0': <mods>/mod_b.jar
+
+- Any version of mod_c, which is missing!
+
+Requiring mods: 
+- Mandatory mod 'mod_a' version '1.0.0': <mods>/mod_a.jar

image

Depends on an invalid mod that also provides an existing mod:
 -- Error 1 --
 
-Unhandled solver error involving the following rules:
-Rule 1:
-Dependency for {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_a' from <mods>/mod_a.jar} on mod_b versions [=1.0.0] (1 valid options, 1 invalid options)
-	+ {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from <mods>/mod_a.jar/mod_b.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from <mods>/mod_a.jar/mod_b.jar}
-	x {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from <mods>/mod_b.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from <mods>/mod_b.jar}
-Rule 2:
-optional mod 'mod_b' (2 sources)
-	 - {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from <mods>/mod_a.jar/mod_b.jar}
-	 - {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from <mods>/mod_b.jar}
-Rule 3:
-Mandatory mod mod_b (mod_b) v2.0.0
-Rule 4:
-Mandatory mod mod_a (mod_a) v1.0.0
+mod_a requires a version [1.0.0, 1.0.0] of mod_b, which is unable to load due to another error!
 
+Requiring mods: 
+- Mandatory mod 'mod_a' version '1.0.0': <mods>/mod_a.jar
+
+Satisfying mods: 
+- Required optional mod 'mod_b' version '1.0.0': <mods>/mod_a.jar/mod_b.jar
+
+Invalid mods: 
+- Mandatory mod 'mod_b' version '2.0.0': <mods>/mod_b.jar
+
+
+-- Error 2 --
+
+Duplicate mandatory mod ids [mod_c]
+- Mandatory mod 'mod_c' version '1.0.0': <mods>/mod_c.jar
+- Provided optional mod 'mod_c' version '1.0.0' from mod 'mod_b' (<mods>/mod_a.jar/mod_b.jar): <mods>/mod_a.jar/mod_b.jar
+
+
+-- Error 3 --
+
+Duplicate mandatory mod ids [mod_b]
+- Required optional mod 'mod_b' version '1.0.0': <mods>/mod_a.jar/mod_b.jar
+- Mandatory mod 'mod_b' version '2.0.0': <mods>/mod_b.jar
 
...

 |--------------|--------------|---------------|--------------|-------|-------------------|----------------------------|
 | Quilt Loader | quilt_loader | 0.26.4-beta.1 | !missing!    |       |                   |                            |
 | mod_a        | mod_a        | 1.0.0         | quilt_loader | ..    |                   | <mods>\mod_a.jar           |
-| mod_b        | mod_b        | 1.0.0         | quilt_loader | ..    |                   | <mods>\mod_a.jar\mod_b.jar |
 | mod_b        | mod_b        | 2.0.0         | quilt_loader | ..    |                   | <mods>\mod_b.jar           |
 | mod_b        | mod_b        | 1.0.0         | quilt_loader | ..    |                   | <mods>\mod_a.jar\mod_b.jar |
+| mod_b        | mod_c        | 1.0.0         | quilt_loader | ..    |                   | <mods>\mod_a.jar\mod_b.jar |
 | mod_c        | mod_c        | 1.0.0         | quilt_loader | ..    |                   | <mods>\mod_c.jar           |
 |--------------|--------------|---------------|--------------|-------|-------------------|----------------------------|

image

Depends on a mod that provides an existing mod:
 -- Error 1 --
 
-Unhandled solver error involving the following rules:
-Rule 1:
-Dependency for {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_a' from <mods>/mod_a.jar} on mod_b versions [*] (1 valid options, 0 invalid options)
-	+ {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from <mods>/mod_a.jar/mod_b.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from <mods>/mod_a.jar/mod_b.jar}
-Rule 2:
-optional mod 'mod_c' (2 sources)
-	 - {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from <mods>/mod_a.jar/mod_b.jar}
-	 - {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_c' from <mods>/mod_c.jar}
-Rule 3:
-Mandatory mod mod_a (mod_a) v1.0.0
-Rule 4:
-Mandatory mod mod_c (mod_c) v1.0.0
+Duplicate mandatory mod ids [mod_c]
+- Provided optional mod 'mod_c' version '1.0.0' from mod 'mod_b' (<mods>/mod_a.jar/mod_b.jar): <mods>/mod_a.jar/mod_b.jar
+- Mandatory mod 'mod_c' version '1.0.0': <mods>/mod_c.jar
 
 
+-- Error 2 --
+
+mod_a requires any version of mod_b, which is unable to load due to another error!
+
+Requiring mods: 
+- Mandatory mod 'mod_a' version '1.0.0': <mods>/mod_a.jar
+
+Satisfying mods: 
+- Required optional mod 'mod_b' version '1.0.0': <mods>/mod_a.jar/mod_b.jar
+
 
...

 | Quilt Loader | quilt_loader | 0.26.4-beta.1 | !missing!    |       |                   |                            |
 | mod_a        | mod_a        | 1.0.0         | quilt_loader | ..    |                   | <mods>\mod_a.jar           |
 | mod_b        | mod_b        | 1.0.0         | quilt_loader | ..    |                   | <mods>\mod_a.jar\mod_b.jar |
-| mod_b        | mod_b        | 1.0.0         | quilt_loader | ..    |                   | <mods>\mod_a.jar\mod_b.jar |
+| mod_b        | mod_c        | 1.0.0         | quilt_loader | ..    |                   | <mods>\mod_a.jar\mod_b.jar |
 | mod_c        | mod_c        | 1.0.0         | quilt_loader | ..    |                   | <mods>\mod_c.jar           |
 |--------------|--------------|---------------|--------------|-------|-------------------|----------------------------|

image

Depends on a missing mod:
 mod-resolving-tests-main requires any version of mod-resolving-tests-library, which is missing!
 
-- <mods>/main.jar
+Requiring mods: 
+- Mandatory mod 'mod-resolving-tests-main' version '1.0.0': <mods>/main.jar

image

Depends on a mod with an array version:
-mod-resolving-tests-main requires version [1.19-alpha.22.24.a, 2) of minecraft, which is missing!
+mod-resolving-tests-main requires a version [1.19-alpha.22.24.a, 2) of minecraft.
 
-- <mods>/mod.jar
+Requiring mods: 
+- Mandatory mod 'mod-resolving-tests-main' version '1.0.0': <mods>/mod.jar
+
+Invalid mods: 
+- Required optional mod 'minecraft' version '1.18.2': <mods>/minecraft.jar

image

Depends on a mod which breaks another mod:
 -- Error 1 --
 
 mod_b breaks all versions of mod_c, which is present!
 
-- <mods>/mod_b.jar
+Breaking mods: 
+- Required mandatory mod 'mod_b' version '1.0.0': <mods>/mod_b.jar
+
+Broken mods: 
+- Mandatory mod 'mod_c' version '1.0.0': <mods>/mod_c.jar
+
+
+-- Error 2 --
+
+mod_a requires any version of mod_b, which is unable to load due to another error!
+
+Requiring mods: 
+- Mandatory mod 'mod_a' version '1.0.0': <mods>/mod_a.jar
+
+Satisfying mods: 
+- Required mandatory mod 'mod_b' version '1.0.0': <mods>/mod_b.jar

image

Depends on a mod broken by another mod:
 -- Error 1 --
 
-Unhandled solver error involving the following rules:
-Rule 1:
-optional mod 'mod_a' (1 source)
-	 - {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_a' from <mods>/mod_a.jar}
-Rule 2:
-Breakage for {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_c' from <mods>/mod_c.jar} on mod_b versions [*] (1 breaking options, 0 okay options)
-	x {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from <mods>/mod_b.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from <mods>/mod_b.jar}
-Rule 3:
-Dependency for {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_a' from <mods>/mod_a.jar} on mod_b versions [*] (1 valid options, 0 invalid options)
-	+ {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from <mods>/mod_b.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from <mods>/mod_b.jar}
-Rule 4:
-Mandatory mod mod_c (mod_c) v1.0.0
+mod_a requires any version of mod_b, which is unable to load due to another error!
 
+Requiring mods: 
+- Mandatory mod 'mod_a' version '1.0.0': <mods>/mod_a.jar
+
+Satisfying mods: 
+- Required mandatory mod 'mod_b' version '1.0.0': <mods>/mod_b.jar
+
+
+-- Error 2 --
+
+mod_c breaks all versions of mod_b, which is present!
+
+Breaking mods: 
+- Mandatory mod 'mod_c' version '1.0.0': <mods>/mod_c.jar
+
+Broken mods: 
+- Required mandatory mod 'mod_b' version '1.0.0': <mods>/mod_b.jar

image

Depends on a mod that provides an existing mod
 -- Error 1 --
 
 Duplicate mandatory mod ids [mod_a]
-- <mods>/mod_a.jar
-- <mods>/mod_b.jar
+- Mandatory mod 'mod_a' version '1.0.0': <mods>/mod_a.jar
+- Provided mandatory mod 'mod_a' version '1.0.0' from mod 'mod_b' (<mods>/mod_b.jar): <mods>/mod_b.jar
 
...

 |--------------|--------------|---------------|--------------|-------|-------------------|------------------|
 | Quilt Loader | quilt_loader | 0.26.4-beta.1 | !missing!    |       |                   |                  |
 | mod_a        | mod_a        | 1.0.0         | quilt_loader | ..    |                   | <mods>\mod_a.jar |
-| mod_b        | mod_b        | 1.0.0         | quilt_loader | ..    |                   | <mods>\mod_b.jar |
+| mod_b        | mod_a        | 1.0.0         | quilt_loader | ..    |                   | <mods>\mod_b.jar |
 | mod_b        | mod_b        | 1.0.0         | quilt_loader | ..    |                   | <mods>\mod_b.jar |
 | mod_c        | mod_c        | 1.0.0         | quilt_loader | ..    |                   | <mods>\mod_c.jar |
 |--------------|--------------|---------------|--------------|-------|-------------------|------------------|

image

Duplicate mods:
 Duplicate mandatory mod ids [mod_a]
-- <mods>/mod_a-v1.jar
-- <mods>/mod_a-v2.jar
+- Mandatory mod 'mod_a' version '1.0.0': <mods>/mod_a-v1.jar
+- Mandatory mod 'mod_a' version '2.0.0': <mods>/mod_a-v2.jar

image

Breaks on all:
 -- Error 1 --
 
-Unhandled solver error involving the following rules:
-Rule 1:
-Dependency for  at line 13 column 24 path $.quilt_loader.breaks[0][0].unless on part_3 versions [*] (0 valid options, 0 invalid options)
-Rule 2:
-Breakage for {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'normal' from <mods>/normal.jar} on all of: 
-	- at line 10 column 12 path $.quilt_loader.breaks[0][0] 
-	- at line 18 column 12 path $.quilt_loader.breaks[0][1] 
-Rule 3:
-Mandatory mod normal (normal) v1.0.0
-Rule 4:
-Breakage for  at line 10 column 12 path $.quilt_loader.breaks[0][0] on part_1 versions [*] (1 breaking options, 0 okay options)
-	x {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'part_1' from <mods>/part_1.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'part_1' from <mods>/part_1.jar}
-Rule 5:
-Mandatory mod part_2 (part_2) v1.0.0
-Rule 6:
-Mandatory mod part_1 (part_1) v1.0.0
-Rule 7:
-Breakage for  at line 18 column 12 path $.quilt_loader.breaks[0][1] on part_2 versions [*] (1 breaking options, 0 okay options)
-	x {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'part_2' from <mods>/part_2.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'part_2' from <mods>/part_2.jar}
+normal breaks because all of the following are present:
+- Any version of part_1:
+  However, if any version of part_3 is present, normal does not break part_1.
+  Matching mods: 
+  - Mandatory mod 'part_1' version '1.0.0': <mods>/part_1.jar
 
+- Any version of part_2:
+  Matching mods: 
+  - Mandatory mod 'part_2' version '1.0.0': <mods>/part_2.jar
+
+Breaking mods: 
+- Mandatory mod 'normal' version '1.0.0': <mods>/normal.jar

image

Depends on any:
-Unhandled solver error involving the following rules:
-Rule 1:
-Mandatory mod normal (normal) v1.0.0
-Rule 2:
-Dependency for  at line 9 column 22 path $.quilt_loader.depends[0][1] on part_2 versions [*] (0 valid options, 0 invalid options)
-Rule 3:
-Dependency for  at line 9 column 12 path $.quilt_loader.depends[0][0] on part_1 versions [*] (0 valid options, 0 invalid options)
-Rule 4:
-Dependancy for {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'normal' from <mods>/normal.jar} on any of: 
-	- at line 9 column 12 path $.quilt_loader.depends[0][0] 
-	- at line 9 column 22 path $.quilt_loader.depends[0][1] 
+normal depends on any of the following mods:
+- Any version of part_2, which is missing!
+- Any version of part_1, which is missing!
 
+Requiring mods: 
+- Mandatory mod 'normal' version '1.0.0': <mods>/normal.jar

image

Provides existing mod:
 Duplicate mandatory mod ids [mod_a]
-- <mods>/mod_a.jar
-- <mods>/mod_b.jar
+- Mandatory mod 'mod_a' version '1.0.0': <mods>/mod_a.jar
+- Provided mandatory mod 'mod_a' version '1.0.0' from mod 'mod_b' (<mods>/mod_b.jar): <mods>/mod_b.jar

image

@OroArmor OroArmor added the enhancement new feature or improvement label Aug 2, 2024
@OroArmor OroArmor marked this pull request as ready for review August 25, 2024 00:40
@ix0rai ix0rai linked an issue Sep 10, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement new feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unhandled Solver Errors
1 participant