{"record":{"id":"7b52fd87afc27738","repo":"apache/maven","slug":"unknown-repository-checksum-policy-artifactrepos","errorCode":null,"errorMessage":"unknown repository checksum policy: {artifactRepositoryPolicy}","messagePattern":"unknown repository checksum policy: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compat/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java","lineNumber":90,"sourceCode":"            enabled = policy.isEnabled();\n            if (policy.getUpdatePolicy() != null) {\n                updates = policy.getUpdatePolicy();\n            }\n            if (policy.getChecksumPolicy() != null) {\n                checksums = policy.getChecksumPolicy();\n            }\n        }\n\n        return new RepositoryPolicy(enabled, updates, checksums);\n    }\n\n    public static String toRepositoryChecksumPolicy(final String artifactRepositoryPolicy) {\n        return switch (artifactRepositoryPolicy) {\n            case RepositoryPolicy.CHECKSUM_POLICY_FAIL -> RepositoryPolicy.CHECKSUM_POLICY_FAIL;\n            case RepositoryPolicy.CHECKSUM_POLICY_IGNORE -> RepositoryPolicy.CHECKSUM_POLICY_IGNORE;\n            case RepositoryPolicy.CHECKSUM_POLICY_WARN -> RepositoryPolicy.CHECKSUM_POLICY_WARN;\n            default ->\n                throw new IllegalArgumentException(\"unknown repository checksum policy: \" + artifactRepositoryPolicy);\n        };\n    }\n}\n","sourceCodeStart":72,"sourceCodeEnd":94,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/compat/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java#L72-L94","documentation":"ArtifactDescriptorUtils.toRepositoryChecksumPolicy maps a legacy Maven repository checksum policy string onto Resolver's policy vocabulary. Only fail, ignore and warn are accepted; any other value (failure, exception, a typo, or an unexpected string) throws IllegalArgumentException naming the offending policy.","triggerScenarios":"Converting an org.apache.maven.artifact.repository.ArtifactRepository policy whose checksum policy string is outside {fail, ignore, warn}, e.g. a legacy 'exception' value or a settings.xml typo reaching this converter during repository translation.","commonSituations":"<checksumPolicy> typos in settings.xml mirrors or repository definitions; legacy configurations predating policy normalization; programmatic artifact-repository construction with unchecked strings.","solutions":["Set the checksum policy to one of fail, warn or ignore (e.g. <checksumPolicy>fail</checksumPolicy> instead of failure)","When reading legacy configs, normalize known legacy values before calling the converter","Null-check policy strings coming from optional XML elements before conversion","Validate policy values at configuration load time with a clear error instead of deep in resolution"],"exampleFix":"<!-- before: invalid policy string -->\n<checksumPolicy>failure</checksumPolicy>\n\n<!-- after: one of fail | warn | ignore -->\n<checksumPolicy>fail</checksumPolicy>","handlingStrategy":"validation","validationCode":"private static final Set<String> VALID_CHECKSUM_POLICIES = Set.of(\"fail\", \"warn\", \"ignore\");\n\nString policy = artifactRepositoryPolicy == null\n        ? \"warn\"\n        : artifactRepositoryPolicy.toLowerCase(Locale.ROOT);\nif (!VALID_CHECKSUM_POLICIES.contains(policy)) {\n    throw new IllegalArgumentException(\"checksumPolicy must be one of \" + VALID_CHECKSUM_POLICIES);\n}\nString resolverPolicy = ArtifactDescriptorUtils.toRepositoryChecksumPolicy(policy);","typeGuard":"static boolean isValidChecksumPolicy(String p) {\n    return p != null && Set.of(\"fail\", \"warn\", \"ignore\").contains(p);\n}","tryCatchPattern":null,"preventionTips":["Restrict checksumPolicy values to fail|warn|ignore in settings templates","Normalize legacy values (failure->fail, exception->fail or warn) at config-load time","Reject unknown policy strings early with a helpful message instead of passing them down"],"tags":["maven","resolver","repository-policy","checksum","config-value"],"backgroundTag":"invalid-config-value","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}