github/github-mcp-server · error

project field %q is included more than once

Error message

project field %q is included more than once

What it means

Thrown while building the visible-field configuration for a project view (create/update view with 'visible_fields' database IDs or 'visible_field_names'). After resolving every requested field against the project, the server deduplicates by the field's GraphQL NodeID; if the same field appears twice it rejects the whole request and names the duplicated field. It exists because the GraphQL mutation for view configuration requires a set of distinct field node IDs.

Source

Thrown at pkg/github/projects.go:2095

				continue
			}
			byDatabaseID[id] = field
		}
		resolved = make([]ResolvedField, 0, len(databaseIDs))
		for _, id := range databaseIDs {
			field, ok := byDatabaseID[id]
			if !ok {
				return nil, fmt.Errorf("project field database ID %d was not found on project %s#%d", id, owner, projectNumber)
			}
			resolved = append(resolved, field)
		}
	}

	nodeIDs := make([]githubv4.ID, 0, len(resolved))
	seen := make(map[string]struct{}, len(resolved))
	for _, field := range resolved {
		if _, ok := seen[field.NodeID]; ok {
			return nil, fmt.Errorf("project field %q is included more than once", field.Name)
		}
		seen[field.NodeID] = struct{}{}
		nodeIDs = append(nodeIDs, githubv4.ID(field.NodeID))
	}
	return &ProjectV2ViewConfigurationInput{VisibleFieldIDs: nodeIDs}, nil
}

// projectViewRequestsVisibleFields reports whether the caller asked for a non-empty
// set of visible fields, without resolving them against the project.
func projectViewRequestsVisibleFields(args map[string]any) bool {
	if databaseIDs, err := OptionalBigIntArrayParam(args, "visible_fields"); err == nil && len(databaseIDs) > 0 {
		return true
	}
	names, err := OptionalStringArrayParam(args, "visible_field_names")
	return err == nil && len(names) > 0
}

func createProjectView(ctx context.Context, gqlClient *githubv4.Client, args map[string]any, owner, ownerType string, projectNumber int) (*mcp.CallToolResult, any, error) {

View on GitHub (pinned to 0ea1f775a7)

Solutions

  1. Remove the duplicated entry from visible_fields / visible_field_names so each field appears once
  2. If merging lists from several sources, deduplicate by field name (or database ID) before sending the request
  3. If unsure which IDs are duplicated, call list_project_fields first and map names to unique database IDs

Example fix

// before
{"owner":"acme","project_number":7,"view_id":"PVTV_...","visible_fields":[8,8,12]}
// after
{"owner":"acme","project_number":7,"view_id":"PVTV_...","visible_fields":[8,12]}
Defensive patterns

Strategy: validation

Validate before calling

// Run before update_project_view: reject duplicate visible-field references.
func checkVisibleFields(args map[string]any) error {
	if ids, ok := args["visible_fields"].([]any); ok {
		seen := map[float64]bool{}
		for _, v := range ids {
			f, ok := v.(float64)
			if !ok {
				return fmt.Errorf("visible_fields entries must be numbers, got %T", v)
			}
			if seen[f] {
				return fmt.Errorf("visible_fields contains duplicate ID %v", f)
			}
			seen[f] = true
		}
	}
	if names, ok := args["visible_field_names"].([]any); ok {
		seen := map[string]bool{}
		for _, v := range names {
			s, ok := v.(string)
			if !ok || seen[s] {
				return fmt.Errorf("visible_field_names contains duplicate or non-string entry %v", v)
			}
			seen[s] = true
		}
	}
	return nil
}

Prevention

When it happens

Trigger: update_project_view (or view creation) called with visible_fields containing the same database ID twice, e.g. [123, 123]; or visible_field_names with a repeated name, e.g. ["Status", "Status"]; or a duplicate that only collapses after resolution against the project's field list.

Common situations: Agents or scripts building the array by concatenating two lists; retry logic appending instead of replacing; copy-paste duplication; UI state that adds a field the user already had selected.

Related errors


AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15). Data as JSON: /api/errors/17120d0ecde784c0. Report an issue: GitHub.