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
The Jira Cloud counterpart of the GitLab duplicate-field check: after consuming an issue (state, type, priority, and explicit mappings all applied), consume() iterates issue.getFields() and throws this ExplicitException if two fields share the same name::value pair, since OneDev issues cannot carry duplicate field mappings.
Source
Thrown at server-plugin/server-plugin-import-jiracloud/src/main/java/io/onedev/server/plugin/imports/jiracloud/ImportServer.java:769
} else {
comment.setUser(OneDev.getInstance(UserService.class).getUnknown());
}
issue.getComments().add(comment);
}
}
}
issue.setCommentCount(issue.getComments().size());
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)",
issueKey, 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
- Inspect the reported issueKey and field name::value in the message; find which two mappings produce it and change one to a different field or value.
- Make type, priority, and explicit field mappings write to distinct OneDev field specs so their name::value pairs cannot collide.
- Remove duplicated mapping rows in the import option's issue field mappings list.
- Dry-run the import first to catch duplicates across all issues before committing data.
Example fix
// before: type mapping and priority mapping both produce 'Category::Bug' typeMapping: Bug -> Category::Bug priorityMapping Highest -> Category::Bug // after typeMapping: Bug -> Category::Bug priorityMapping Highest -> Importance::High
Defensive patterns
Strategy: validation
Validate before calling
Set<String> targets = new HashSet<>();
for (IssueFieldMapping m : option.getIssueFieldMappings())
if (!targets.add(m.getOneDevIssueField())) throw new IllegalArgumentException("Duplicate mapping target: " + m.getOneDevIssueField()); Try / catch
try { importServer.doImport(...) } catch (ExplicitException e) { if (e.getMessage().startsWith("Duplicate issue field mapping")) { /* fix colliding mappings for the reported issue */ } } Prevention
- Ensure type, priority, and field mappings target distinct field::value pairs.
- Deduplicate mapping rows when saving the option.
- Dry-run to detect collisions before the real import.
When it happens
Trigger: consume() builds fields for one issue — e.g. both the type mapping and the priority mapping (or two explicit field mappings) resolve to the same FieldSpec name with the same value — and the fieldAndValues set add returns false for issueKey.
Common situations: Type mapping and priority mapping both target the same OneDev field/value; duplicated rows in the issue field mappings form; a source Jira field mapped twice with identical resulting value.
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
- Duplicate issue field mapping (issue: %s, field: %s)
- Error validating imported build spec (import project: %s, im
- Import target already exists. You need to have project manag
- Unable to find project:
- No field spec found:
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/de3f0ed7b51c9dc3.
Report an issue: GitHub.