{"record":{"id":"17120d0ecde784c0","repo":"github/github-mcp-server","slug":"project-field-q-is-included-more-than-once","errorCode":null,"errorMessage":"project field %q is included more than once","messagePattern":"project field %q is included more than once","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/projects.go","lineNumber":2095,"sourceCode":"\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbyDatabaseID[id] = field\n\t\t}\n\t\tresolved = make([]ResolvedField, 0, len(databaseIDs))\n\t\tfor _, id := range databaseIDs {\n\t\t\tfield, ok := byDatabaseID[id]\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"project field database ID %d was not found on project %s#%d\", id, owner, projectNumber)\n\t\t\t}\n\t\t\tresolved = append(resolved, field)\n\t\t}\n\t}\n\n\tnodeIDs := make([]githubv4.ID, 0, len(resolved))\n\tseen := make(map[string]struct{}, len(resolved))\n\tfor _, field := range resolved {\n\t\tif _, ok := seen[field.NodeID]; ok {\n\t\t\treturn nil, fmt.Errorf(\"project field %q is included more than once\", field.Name)\n\t\t}\n\t\tseen[field.NodeID] = struct{}{}\n\t\tnodeIDs = append(nodeIDs, githubv4.ID(field.NodeID))\n\t}\n\treturn &ProjectV2ViewConfigurationInput{VisibleFieldIDs: nodeIDs}, nil\n}\n\n// projectViewRequestsVisibleFields reports whether the caller asked for a non-empty\n// set of visible fields, without resolving them against the project.\nfunc projectViewRequestsVisibleFields(args map[string]any) bool {\n\tif databaseIDs, err := OptionalBigIntArrayParam(args, \"visible_fields\"); err == nil && len(databaseIDs) > 0 {\n\t\treturn true\n\t}\n\tnames, err := OptionalStringArrayParam(args, \"visible_field_names\")\n\treturn err == nil && len(names) > 0\n}\n\nfunc createProjectView(ctx context.Context, gqlClient *githubv4.Client, args map[string]any, owner, ownerType string, projectNumber int) (*mcp.CallToolResult, any, error) {","sourceCodeStart":2077,"sourceCodeEnd":2113,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/projects.go#L2077-L2113","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Remove the duplicated entry from visible_fields / visible_field_names so each field appears once","If merging lists from several sources, deduplicate by field name (or database ID) before sending the request","If unsure which IDs are duplicated, call list_project_fields first and map names to unique database IDs"],"exampleFix":"// before\n{\"owner\":\"acme\",\"project_number\":7,\"view_id\":\"PVTV_...\",\"visible_fields\":[8,8,12]}\n// after\n{\"owner\":\"acme\",\"project_number\":7,\"view_id\":\"PVTV_...\",\"visible_fields\":[8,12]}","handlingStrategy":"validation","validationCode":"// Run before update_project_view: reject duplicate visible-field references.\nfunc checkVisibleFields(args map[string]any) error {\n\tif ids, ok := args[\"visible_fields\"].([]any); ok {\n\t\tseen := map[float64]bool{}\n\t\tfor _, v := range ids {\n\t\t\tf, ok := v.(float64)\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"visible_fields entries must be numbers, got %T\", v)\n\t\t\t}\n\t\t\tif seen[f] {\n\t\t\t\treturn fmt.Errorf(\"visible_fields contains duplicate ID %v\", f)\n\t\t\t}\n\t\t\tseen[f] = true\n\t\t}\n\t}\n\tif names, ok := args[\"visible_field_names\"].([]any); ok {\n\t\tseen := map[string]bool{}\n\t\tfor _, v := range names {\n\t\t\ts, ok := v.(string)\n\t\t\tif !ok || seen[s] {\n\t\t\t\treturn fmt.Errorf(\"visible_field_names contains duplicate or non-string entry %v\", v)\n\t\t\t}\n\t\t\tseen[s] = true\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build visible-field arrays through a set (map) so duplicates cannot enter","Never concatenate two field lists without deduplicating by name/ID","Remember visible_fields and visible_field_names are mutually exclusive; mixing them fails earlier with its own error"],"tags":["projects","validation","duplicates","graphql"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}