theonedev/onedev · error · ExplicitException

Duplicate issue field mapping (issue: %s, field: %s)

Error message

Duplicate issue field mapping (issue: %s, field: %s)

What it means

During GitHub issue import, each imported issue's field mappings (name::value pairs) are deduplicated via a set; a repeated identical pair means two labels/mappings resolve to the same field value for that issue, so consume throws this ExplicitException to prevent ambiguous duplicate assignments.

Source

Thrown at server-plugin/server-plugin-import-github/src/main/java/io/onedev/server/plugin/imports/github/ImportServer.java:414

								tagField.setOrdinal(mapped.getLeft().getOrdinal(mapped.getRight()));
								issue.getFields().add(tagField);
							} else {
								currentUnmappedLabels.add(labelName);
								unmappedIssueLabels.add(HtmlEscape.escapeHtml5(labelName));
							}
						}

						if (!currentUnmappedLabels.isEmpty()) 
							extraIssueInfo.put("Labels", joinAsMultilineHtml(currentUnmappedLabels));
						
						Set<String> fieldAndValues = new HashSet<>();
						for (IssueField field: issue.getFields()) {
							String fieldAndValue = field.getName() + "::" + field.getValue();
							if (!fieldAndValues.add(fieldAndValue)) {
								String errorMessage = String.format(
										"Duplicate issue field mapping (issue: %s, field: %s)", 
										gitHubRepo + "#" + oldNumber, fieldAndValue);
								throw new ExplicitException(errorMessage);
							}
						}
						
						if (!extraIssueInfo.isEmpty()) {
							StringBuilder builder = new StringBuilder("|");
							for (String key: extraIssueInfo.keySet()) 
								builder.append(key).append("|");
							builder.append("\n|");
							extraIssueInfo.keySet().stream().forEach(it->builder.append("---|"));
							builder.append("\n|");
							for (String value: extraIssueInfo.values())
								builder.append(value).append("|");
							
							if (issue.getDescription() != null)
								issue.setDescription(builder.toString() + "\n\n" + issue.getDescription());
							else
								issue.setDescription(builder.toString());
						}

View on GitHub (pinned to d44925c47c)

Solutions

  1. Deduplicate IssueLabelMappings in the import option so no two labels map to the same field::value
  2. Inspect the reported issue's labels and remove one of the colliding labels in GitHub or exclude it via mapping
  3. Use distinct field values per label (e.g. Type::Bug vs Type::Task)
  4. Re-run the import after cleaning up

Example fix

// before: issue has labels 'bug' and 'critical' both mapped
bug      -> Type::Bug
critical -> Type::Bug  // duplicate
// after
critical -> Priority::High
Defensive patterns

Strategy: validation

Validate before calling

Set<String> targets = new HashSet<>();
for (var m : importOption.getIssueLabelMappings()) {
    if (!targets.add(m.getOneDevIssueField()))
    throw new IllegalArgumentException("Two labels map to same field: " + m.getOneDevIssueField());
}

Try / catch

try { importServer.importIssues(...); } catch (ExplicitException e) { if (e.getMessage().contains("Duplicate issue field mapping")) { /* adjust mappings/labels, re-run */ } else throw e; }

Prevention

When it happens

Trigger: Importing an issue whose GitHub labels hit two IssueLabelMappings producing the same oneDev field name and value, or duplicate mappings in the import option for repo gitHubRepo#oldNumber.

Common situations: An issue tagged with two labels that both map to the same field::value; misconfigured mapping list with repeated entries; label plus default field assignment colliding.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/2436406285db075d. Report an issue: GitHub.