Kir-Antipov/mc-publish

Bad request when trying to upload mod

Closed this issue · 3 comments

I'm trying to upload a new mod through mc-publish with a workflow that I have used on another project before, but I'm getting the following error:

HttpError: 400 (Bad Request, {"error":"invalid_input","description":"Error while validating input: Field dependencies failed validation with error: duplicate dependency"})

I asked around on the Modrinth Discord but it seems like there's something wrong with the request itself. I can't really debug it however, so I'm clueless as to why it doesn't work.

My latest failed build can be found over here: https://github.com/Scubakay/litematica-enderchest-materials/actions/runs/5269300993
And my workflow file over here: https://github.com/Scubakay/litematica-enderchest-materials/blob/master/.github/workflows/gradle.yml

I don't seem to have any duplicate dependencies in my fabric.mod.json or build.gradle that I can see:

build.gradle:

dependencies {
    // To change the versions see the gradle.properties file
    minecraft "com.mojang:minecraft:${project.minecraft_version}"
    mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
    modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

    // Fabric API. This is technically optional, but you probably want it anyway.
    modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

    modImplementation "curse.maven:litematica-${project.litematica_minecraft_version}-308892:${project.litematica_fileid}"
    modImplementation "curse.maven:malilib-${project.litematica_minecraft_version}-303119:${project.malilib_fileid}"
}

fabric.mod.json:

"depends": {
    "fabricloader": ">=${loader_version}",
    "fabric": "*",
    "minecraft": "${minecraft_version}",
    "fabric-api": "*"
  }

Would you maybe have any ideas as to why I'm getting this error?

This previously worked due to an explicit sorting process that weeded out duplicate dependencies. Unfortunately, this piece of logic wasn't carried over to v3.3, hence the issue you're currently facing. Thank you for bringing this oversight to my attention.

In your specific case, the duplicates being flagged are fabric and fabric-api. They're both identified and processed as if they were fabric-api, leading to the conflict you're experiencing. However, I'm curious as to why both are necessary in your configuration? Is there a particular reason that necessitates including both? Or perhaps I've overlooked something with regards to the naming conventions in the Fabric project.

Thanks for your answer! Sorry for the late response, I've been quite busy.

"depends": {
    "fabricloader": ">=${loader_version}",
    "minecraft": "${minecraft_version}",
    "fabric-resource-loader-v0": "*",
    "litematica": "0.15.0",
    "malilib": "0.16.0"
  }

Looks like removing the "fabric" dependency worked indeed! Also, I didn't need fabric-api anymore so I removed that too.

I'm glad that the problem is no longer relevant for your case! But I'll keep the issue open so I won't forget to re-introduce filter for duplicate dependencies.