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

This ExplicitException is thrown by the GitLab issue import consumer in server-plugin-import-gitlab when, after all field mappings are built for a single issue, two or more IssueField entries resolve to the same name::value pair. OneDev requires every custom field on an imported issue to be unique, so a duplicate mapping would be silently dropped or corrupted downstream; the import aborts with an explicit, user-facing message instead.

Source

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

									} else {
										comment.setUser(OneDev.getInstance(UserService.class).getUnknown());
										nonExistentLogins.add(authorNode.get("username").asText());
									}
									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)", 
										issueFQN, 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. Open the import option's issue field mappings in the GitLab import form and remove entries that duplicate another mapping's OneDev field name and value.
  2. If two source fields intentionally map to one OneDev field, merge them into a single mapping or map them to distinct OneDev fields so name::value pairs are unique.
  3. Re-run the import (optionally with dry run first); the message names the offending issue and field pair, then adjust only those mappings.
  4. If the duplicate comes from auto-derived fields (state/type/priority), change the explicit field mapping to a different field name so it no longer collides.

Example fix

// before: two mappings both resolve to 'Severity::High'
mapping1: sourceField=labels   -> oneDevIssueField=Severity::High
mapping2: sourceField=priority -> oneDevIssueField=Severity::High
// after
mapping1: sourceField=labels   -> oneDevIssueField=Severity::High
mapping2: sourceField=priority -> oneDevIssueField=PriorityLabel::High
Defensive patterns

Strategy: validation

Validate before calling

Set<String> seen = new HashSet<>();
for (IssueField f : issue.getFields()) {
    if (!seen.add(f.getName() + "::" + f.getValue()))
        throw new IllegalArgumentException("Duplicate field: " + f.getName());
}

Try / catch

try { importServer.doImport(...) } catch (ExplicitException e) { if (e.getMessage().startsWith("Duplicate issue field mapping")) { /* fix mappings in import option */ } else throw e; }

Prevention

When it happens

Trigger: Running a GitLab import whose issue field mappings produce two fields with identical name and value for the same issue — e.g. two IssueFieldMapping rows pointing at the same OneDev field, or a mapping that yields the same name::value as a type/priority/state-derived field. Detected inside consume() while iterating issue.getFields() into a fieldAndValues set.

Common situations: Config where several source fields map to the same OneDev custom field name with the same value; copy-pasted duplicate mapping entries in the import option form; an issue whose imported state/priority fields collide with an explicitly mapped field using the same name and 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


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